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
indent = function(string, indents) {
indents = (new Array(indents)).join(' ')
return string.replace(/^/gm, function(){ return indents })
...
JavaScript indent string
Cleaner way?
#include <stdio.h> #include <stdlib.h> ...
C Polymorphic functions using...
The *stupid* example below ...
/** * 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...
class String
def strip chars = "\s"
gsub /^[#{chars}]+|[#{chars}}]+$/, ''
...
Ruby String#strip with char list
Better way?
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...
require 'ostruct' require 'rubygems' require 'extlib/blank' ...
Ruby includes_all?
by Tj Holowaychuk,
January 05, 2009 21:14,
5 refactorings
Having brain cramps today, ...
def run_once &block path = File.expand_path caller.first unless ($__run_once ||= []).include? path ...
Ruby On Method Hooks in Ruby: any c...
by Tj Holowaychuk,
December 10, 2008 17:34
GAH! the output portion did...
require 'fileutils' module VerboseFileUtils ...
Ruby On Method Hooks in Ruby: any c...
by Tj Holowaychuk,
December 10, 2008 17:34
Not sure if this really is ...
Ruby On Bindings on caller
by Tj Holowaychuk,
November 22, 2008 15:48
Cool thanks! not overly pra...
def test(a, b) capitalize_args puts a # => Hello ...
Ruby Bindings on caller
I dont really have a need f...
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...
require 'uri' module URI ...
Ruby On Shortest regular expression...
by Tj Holowaychuk,
November 21, 2008 07:53
I would maybe consider exte...

This is the cleanest way I ...