This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Rules: | |
* - no includes | |
* - play by the spirit of the game | |
* - sort any set of positive numbers in as few characters as possible | |
* - just define minisort.c | |
* - -Wall -Wextra must produce no warnings | |
* - test with ./driver 4 1 2 65 92 etc | |
*/ | |
void sort(int *a, int i) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require './disjoint-union' | |
def to_dot | |
puts "digraph {" | |
for n in @nodes | |
puts "\t#{n.value} -> #{n.parent.value};" | |
end | |
puts "}\n\n" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
src = open(caller[-2].split(':').first).read | |
eval src.gsub(/[\S]/, '').split("\n").drop(1).map {|x| x.size.chr }.join('') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'digest/sha2' | |
args = { | |
host: 'example.com', | |
status: 'up', | |
custom_status: 'All services restored', | |
timestamp: Time.now.utc.to_s | |
} | |
# Signature is: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create the instance and set up the roles | |
i = Instance.create(:long_name => "Instance Long Name") | |
i.short_name = "short_name" | |
i.roles = Role.default_setup | |
i.save | |
# create a new user | |
u = User.create(:first_name => "John", :last_name => "Smith", :email => "johnsmith@example.com") | |
u.role = i.roles.find_by_name('Super Administrator') # assign a role | |
u.generate_salt! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
setInterval(function(){ | |
$("link").each(function(){ | |
this.href = this.href.replace(/\?.*|$/,"?"+ new Date().getTime()); | |
}); | |
}, 1000); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'rubygems' | |
require 'hpricot' | |
require 'open-uri' | |
require 'active_support' | |
entries = %w[ | |
http://nodeknockout.com/teams/jackalope | |
http://nodeknockout.com/teams/medium | |
http://nodeknockout.com/teams/speedo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra/base' | |
class A < Sinatra::Base | |
before { puts 'A in' } | |
after { puts 'A out' } | |
end | |
class B < Sinatra::Base | |
before { puts 'B in' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%w(rubygems sinatra active_record models json).each{|lib| require lib} | |
get %r{/assignments/reconcile(\.json)?}' do |capture| | |
@reconcile = reconcile_assignments | |
if capture | |
@reconcile.to_json | |
else | |
erb :reconcile | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def setup | |
size 600, 600 | |
end | |
def draw | |
background 255 | |
within_matrix do | |
translate 300, 300 | |
rotate 3.1415/4 | |
fill 128 |