Skip to content

Instantly share code, notes, and snippets.

Chris Wanstrath defunkt

Block or report user

Report or block defunkt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:cda3a6a1d039398f09ee
class JobSchedule
# External interface for calling the service
def self.call(object_id, opts={})
if perform_asynchronously?
Delayed::Job.enqueue(EnqueuedJob.new(name, object_id, opts))
else
perform(object_id, opts)
end
end
View Cash_Register_1.rb
puts "What is the amount due?"
total = gets.chomp.to_f
puts "What is the amount tendered?"
paid = gets.chomp.to_f
if paid < total
puts "WARNING: Customer still owes $#{format("%.2f", total-paid)}"
puts Time.now
elsif paid > total
View namespace.coffee
Namespace = ( ->
merge = (target, source) ->
for key, val of source
target[key] = val
target
_assertValidFQN = (fqn) ->
unless ///^[a-z0-9_.]+///.test fqn then throw 'invalid namespace'
class Procedure
View binary.html
<!-- http://emilsblog.lerch.org/2009/07/javascript-hacks-using-xhr-to-load.html -->
<html5>
<head>
<script language="vbscript">
Function BinaryArrayToAscCSV( aBytes )
Dim j, sOutput
sOutput = "BinaryArrayToAscCSV"
For j = 1 to LenB(aBytes)
sOutput= sOutput & AscB( MidB(aBytes,j,1) )
We couldn’t find that file to show.
@defunkt
defunkt / gitio
Created Sep 11, 2011
Turn a github.com URL into a git.io URL.
View gitio
#!/usr/bin/env ruby
# Usage: gitio URL [CODE]
#
# Turns a github.com URL
# into a git.io URL
#
# Copies the git.io URL to your clipboard.
url = ARGV[0]
code = ARGV[1]
@defunkt
defunkt / grove.io.js
Created Aug 17, 2011
grove.io dotjs script for inlining images
View grove.io.js
setInterval(function(){
$('.content a').each(function() {
if (/\.(gif|jpe?g|png)/i.test($(this).text()))
$(this).html('<img src="'+$(this).text()+'"/>"')
})
}, 1000)
@defunkt
defunkt / cloudapp.com.js
Created Jul 14, 2011
CloudApp ~/.js enhancement
View cloudapp.com.js
window.location = 'https://my.cl.ly'
You can’t perform that action at this time.