Public Gists by dcparker

Gravatar
Tue Oct 06 19:12:18 -0700 2009
1
2
3
# Adjusts Google Calendar ical times for TimeZone ONLY WHEN NECESSARY
 
tzadjust = Time.gcalschema("#{e["DTSTART;TZID=#{self.time_zone_name}"] || "#{e['DTSTART;VALUE=DATE']}T000000"}Z").nil? ? -4*3600 : 0
Gravatar
Thu Sep 17 09:31:22 -0700 2009
1
2
3
curl "http://repo.or.cz/w/git.git?a=blob_plain;f=contrib/completion/git-completion.bash;h=4ea727b14303e397117067993dbda446ed154ea1;hb=HEAD" > ~/.git_bash_completion.sh
chmod +x ~/.git_bash_completion.sh
echo " source ~/.git_bash_completion.sh
Gravatar
Tue Sep 15 09:09:44 -0700 2009
1
2
3
###########
## File: app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
Gravatar
Tue Sep 15 08:53:40 -0700 2009
1
2
3
#!/usr/bin/env ruby
# mategem (bash command)
 
Gravatar
Thu Sep 10 10:01:18 -0700 2009
1
2
3
#!/usr/bin/perl -w
 
# Small program to process a tiff file into a PDF and email it via gmail.
Gravatar
Tue Aug 11 11:37:56 -0700 2009
1
2
3
String::ALPHANUMERIC_CHARACTERS = ('a'..'z').to_a + ('A'..'Z').to_a
def String.random(size)
  length = String::ALPHANUMERIC_CHARACTERS.length
Gravatar
Tue Aug 11 10:19:08 -0700 2009
1
2
3
require 'socket'
 
socket = TCPServer.new('0.0.0.0', '8080')
Gravatar
Tue Jul 21 07:57:49 -0700 2009
1
var ElementObject=function(n,a,c){var t=this;t.name=n;t.attributes=a;t.contents=c;t.toHTML=function(){var b=[];for(k in a){if(a.hasOwnProperty(k))b.push(k+'="'+a[k]+'"');}var h='<'+n;if(b.length>0)h=h+' '+b.join(' ');if(c!=='')h=h+'>'+c+'</'+n+'>';else h=h+'/>';return h;};};
Gravatar
Fri Jun 05 13:59:07 -0700 2009
1
2
3
/*
  Creates an edit box to replace any element, along with a callback
  function to handle the return value. Call this in real time, not
Gravatar
Fri May 01 08:44:11 -0700 2009
1
2
3
git init
git remote add -t $2 origin $1
git fetch
Gravatar
Sun Apr 26 18:27:20 -0700 2009
1
2
3
require 'active_record/connection_adapters/abstract_adapter'
 
require 'bigdecimal'
Gravatar
Wed Mar 25 11:47:25 -0700 2009
1
2
3
require 'socket'
require 'openssl'
require 'net/ftp'
gist: 83677 Emulate key-value pairs in ...
Gravatar
Mon Mar 23 10:43:57 -0700 2009
1
2
3
function Hash {
  if [[ -n $3 ]]; then # three param: assignment
    export "hash_${1}_${2}"=$3
Gravatar
Mon Mar 23 10:39:05 -0700 2009
1
2
3
function Hash {
  if [[ -n $3 ]]; then # three param: assignment
    export typeset hash_${1}_${2}=$3
Gravatar
Mon Mar 16 13:46:16 -0700 2009
1
2
3
local_rubygems = !!($:[0] == '.')
$:.shift if local_rubygems # Takes off the extra '.' put on the beginning. Now the next line will require the real rubygems
# Now require the REAL rubygems.
Gravatar
Thu Mar 05 13:23:52 -0800 2009
1
2
3
#!/usr/bin/ruby
 
class WalkDirTree
Gravatar
Tue Jan 06 12:32:09 -0800 2009
1
2
3
require 'net/http'
require 'uri'
require 'time'