Skip to content

Instantly share code, notes, and snippets.

View metaskills's full-sized avatar
🐙
Being Inkcellent to Each Other

Ken Collins metaskills

🐙
Being Inkcellent to Each Other
View GitHub Profile
require 'rubygems'
require 'activesupport'
class Foo
# Mimic Magic
cattr_accessor :bar
class << self
def set_bar(value)
@@bar = value
end
class EPlayer < Player
def initialize( opponent_class_name )
@oc = Module.const_get opponent_class_name
hack_game
end
def choose
sabotage find_opponent
hack_game
:paper
Real world savings for people that run real webservers is equal
to 8 kilobytes. Get real, get pragmatic and stop byte fucking!
| orig | YUI'ed
----------------------------------
prototype.js | 129.7 | 74.9
(gzipped) | 29.9 | 21.9
require 'fileutils'
source_path = "/Users/kencollins/Desktop/source.txt"
move_path = "/Users/kencollins/Desktop/move.txt"
FileUtils.rm move_path if File.exists?(move_path)
File.open(source_path,'w') { |f| 30000.times{f.write("#{'x'*70}\n")} }
FileUtils.move source_path, move_path
# ISSUE: http://github.com/thoughtbot/paperclip/issues/#issue/118
has_attached_file :file, :processors => [:noop]
module Paperclip
class Noop < Processor
def make
file
From d6e50913039d93d5a55daf3e952c79c839f9cdca Mon Sep 17 00:00:00 2001
From: Ken Collins <ken@metaskills.net>
Date: Mon, 23 Nov 2009 11:44:23 -0500
Subject: [PATCH] Allow :processors => false option to no op any processor actions.
---
lib/paperclip/attachment.rb | 2 +-
test/attachment_test.rb | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 1 deletions(-)
myrsync_src="/Users/kencollins/Work Shed"
myrsync_dest="/Volumes/backup/Exchange/Work Shed"
function mount_backup () {
if [[ ! -d /Volumes/backup ]]; then
mkdir /Volumes/backup
mount_afp afp://user:pass@nas.actionmoniker.com/backup /Volumes/backup
fi
}
@metaskills
metaskills / gist:256261
Created December 14, 2009 18:04
A few of my ZSH functions for Git SVN
function gsrb () {
branch=$(git-branch-name)
git checkout master
git svn rebase
git checkout "${branch}"
git rebase master
}
function gsu () {
git checkout master
NSSet *touches = (NSSet *)[touchesAndEvent objectForKey:@"touches"];
class User
def self.space
'Top'
end
end
module MyNamespace
class User
def self.space