int 
main(int argc, char **argv) {
  while (*++argv) printf("%s\n", *argv); 
...

C argv iteration

by Tj Holowaychuk, April 30, 2009 19:07, 4 refactorings

This is the cleanest way I ...

F1e3ab214a976a39cfd713bc93deb10f Talk
indent = function(string, indents) {
  indents = (new Array(indents)).join('  ')
  return string.replace(/^/gm, function(){ return indents })
...

JavaScript indent string

by Tj Holowaychuk, April 24, 2009 16:06, 4 refactorings, tagged with indent

Cleaner way?

F1e3ab214a976a39cfd713bc93deb10f Talk
#include <stdio.h>
#include <stdlib.h>

...

C Polymorphic functions using...

by Tj Holowaychuk, April 21, 2009 23:24, 5 refactorings, tagged with pointers polymorphic

The *stupid* example below ...

F1e3ab214a976a39cfd713bc93deb10f Talk
---
--- Tag
...

Haskell Tag

by Tj Holowaychuk, April 13, 2009 01:03, 3 refactorings, tagged with html tags

Just playing around, super ...

F1e3ab214a976a39cfd713bc93deb10f Talk
describe 'ShoppingCart'
  var cart

...

JavaScript Testing Framework

by Tj Holowaychuk, April 11, 2009 19:26, No refactoring, tagged with test framework jspec

Snippit from http://visionm...

F1e3ab214a976a39cfd713bc93deb10f Talk
class String
  def dasherize
...

Ruby Hash#switchify

by Tj Holowaychuk, April 08, 2009 21:26, 3 refactorings, tagged with ruby, hash, switch

Whipped this up really quic...

F1e3ab214a976a39cfd713bc93deb10f Talk
class String
  def wrap prefix, suffix = nil
    [prefix, self, (suffix || prefix)].join
...

Ruby Simple wrap method

by Tj Holowaychuk, March 20, 2009 18:35, 7 refactorings

rawr

F1e3ab214a976a39cfd713bc93deb10f Talk
/**
 * Create a range string which can be evaluated to a native array.
 *
...

JavaScript Range

by Tj Holowaychuk, March 17, 2009 21:26, 6 refactorings

I use this in a JS interpre...

F1e3ab214a976a39cfd713bc93deb10f Talk
class String
  def strip chars = "\s"
    gsub /^[#{chars}]+|[#{chars}}]+$/, ''
...

Ruby String#strip with char list

by Tj Holowaychuk, February 21, 2009 01:08, 6 refactorings, tagged with string strip

Better way?

F1e3ab214a976a39cfd713bc93deb10f Talk
require 'rubygems'

class Numeric
...

Ruby Time lost since

by Tj Holowaychuk, February 02, 2009 18:34, No refactoring, tagged with time date

Pasted the rest just so peo...

F1e3ab214a976a39cfd713bc93deb10f Talk
params[:name][:primary] # etc ...

Ruby Recursive population of has...

by Tj Holowaychuk, January 23, 2009 20:13, 11 refactorings

I do not even know where to...

F1e3ab214a976a39cfd713bc93deb10f Talk
include Form::Elements

...

Ruby Closure scoping issue

by Tj Holowaychuk, January 09, 2009 20:14, 5 refactorings, tagged with form

Below is the syntax I would...

F1e3ab214a976a39cfd713bc93deb10f Talk
require 'ostruct'
require 'rubygems'
require 'extlib/blank'
...

Ruby includes_all?

by Tj Holowaychuk, January 05, 2009 21:14, 5 refactorings

Having brain cramps today, ...

F1e3ab214a976a39cfd713bc93deb10f Talk
def run_once &block
  path = File.expand_path caller.first
  unless ($__run_once ||= []).include? path
...

Ruby Run once

by Tj Holowaychuk, December 16, 2008 21:30, 9 refactorings

Cleaner way?

F1e3ab214a976a39cfd713bc93deb10f Talk
# Working example
def test &block
...

Ruby Proc param names

by Tj Holowaychuk, December 12, 2008 23:20, 5 refactorings, tagged with binding

Below is the exact result I...

F1e3ab214a976a39cfd713bc93deb10f Talk

Ruby On Method Hooks in Ruby: any c...

by Tj Holowaychuk, December 10, 2008 17:34 Star_fullStar_fullStar_fullStar_full

GAH! the output portion did...

F1e3ab214a976a39cfd713bc93deb10f Talk
require 'fileutils'

module VerboseFileUtils
...

Ruby On Method Hooks in Ruby: any c...

by Tj Holowaychuk, December 10, 2008 17:34 Star_fullStar_fullStar_fullStar_full

Not sure if this really is ...

F1e3ab214a976a39cfd713bc93deb10f Talk

Ruby On Bindings on caller

by Tj Holowaychuk, November 22, 2008 15:48

Cool thanks! not overly pra...

F1e3ab214a976a39cfd713bc93deb10f Talk
def test(a, b)
  capitalize_args
  puts a   # => Hello
...

Ruby Bindings on caller

by Tj Holowaychuk, November 22, 2008 06:16, 2 refactorings, tagged with binding

I dont really have a need f...

F1e3ab214a976a39cfd713bc93deb10f Talk
def monitor(uri)
  Thread.new(uri) do |uri|
    begin
...

Ruby Initial script execution ve...

by Tj Holowaychuk, November 22, 2008 02:27, 1 refactoring

Below is a little snippit o...

F1e3ab214a976a39cfd713bc93deb10f Talk
NAME:
  
...

Ruby suppress ERB newlines

by Tj Holowaychuk, November 22, 2008 02:16, No refactoring, tagged with erb

Just plain-jane ERB. What d...

F1e3ab214a976a39cfd713bc93deb10f Talk
require 'uri'

module URI
...

Ruby On Shortest regular expression...

by Tj Holowaychuk, November 21, 2008 07:53 Star_full

I would maybe consider exte...

F1e3ab214a976a39cfd713bc93deb10f Talk
require File.dirname(__FILE__) + '/memcached'

class Object
...

Ruby On Caching Methods

by Tj Holowaychuk, November 19, 2008 18:11

Added transparent hard cach...

F1e3ab214a976a39cfd713bc93deb10f Talk
class Object
  
  def self.cache_method(method, options = {})
...

Ruby On Caching Methods

by Tj Holowaychuk, November 19, 2008 17:29

Heres what I have so far

F1e3ab214a976a39cfd713bc93deb10f Talk

Ruby On Caching Methods

by Tj Holowaychuk, November 19, 2008 17:04

Heres a stupid question. Ho...

F1e3ab214a976a39cfd713bc93deb10f Talk