Skip to content

Instantly share code, notes, and snippets.

View jherdman's full-sized avatar

James Herdman jherdman

View GitHub Profile
## Note to self...
include Benchmark
number = 2
year = 2008
bmbm(6) do |x|
x.report 'joining' do
10_000.times do
# This is lifted from TextMate's Ruby snippets. It's kind of handy and comes up now and then.
module
module ClassMethods
end
module InstanceMethods
end
// By Oliver Saunders. http://wiki.github.com/schapin/gospel/textmate-language-file
{ scopeName = 'source.gospel';
fileTypes = ( 'gs' );
foldingStartMarker = '/\*\*|\{\s*$';
foldingStopMarker = '\*\*/|^\s*\}';
patterns = (
{ name = 'keyword.constant.gospel';
match = '\b(recurse|namespace)\b';
},
{ name = 'meta.heading.text';
/*
* Extends Date to return the 24-hour clock time using 15 minute intervals for the
* minutes portion. E.x. If it is 11:04PM, this function returns 2300.
*/
Date.prototype.getInterval = function() {
var now = new Date();
var intervals = ["00", "15", "30", "45", "60"];
for(var i = 0; i < intervals.length; i++) {
var mins = now.getMinutes();
if(parseInt(intervals[i], 10) <= mins && mins <= parseInt(intervals[i + 1], 10)) {
(~)→ sudo port install screen
---> Fetching screen
---> Verifying checksum(s) for screen
---> Extracting screen
---> Applying patches to screen
---> Configuring screen
---> Building screen
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_sysutils_screen/work/screen-4.0.3" && make all " returned error 2
Command output: vproc_priv.h:101: warning: parameter names (without types) in function declaration
vproc_priv.h:101: warning: data definition has no type or storage class
#!/usr/bin/ruby
# jsmin.rb 2007-07-20
# Author: Uladzislau Latynski
# This work is a translation from C to Ruby of jsmin.c published by
# Douglas Crockford. Permission is hereby granted to use the Ruby
# version under the same conditions as the jsmin.c on which it is
# based.
#
# /* jsmin.c
# 2003-04-21
def generate(params, defaults = {})
param_or_default = lambda { |p, d, k| (p[k] || d[k]).to_s }
matches = lambda { |v| v =~ /^(?-mix:[^\/.,;?]+)$/ }
v_controller = param_or_default.call(params, defaults, :controller)
v_action = param_or_default.call(params, defaults, :action)
v_id = param_or_default.call(params, defaults, :id)
unless matches.call(v_controller)
raise ArgumentError, "Condition cannot be generated with #{params.inspect}"
##
# XCode stuff for Git
##
## .gitignore
# xcode noise
build/*
*.pbxuser
*.mode1v3
#!/usr/bin/ruby
# jsmin.rb 2007-07-20
# Author: Uladzislau Latynski
#
# This work is a translation from C to Ruby of jsmin.c published by
# Douglas Crockford. Permission is hereby granted to use the Ruby
# version under the same conditions as the jsmin.c on which it is
# based.
#
# jsmin.c
/**
* This is a heaviy modified version of Peter Vulgaris' jquery.autosuggest
* plugin. In fact, you're probably going to need to do some heavy squinting
* to recognize the original code.
*
* What's Different?
* =================
*
* Cleaner Code
* ------------