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
#!/usr/bin/python | |
import os | |
import subprocess as sub | |
import urllib2 | |
from BeautifulSoup import BeautifulSoup | |
TWITTERUSER = cupcakory # if you want to check twitter.com/cupcakory for updates | |
EMAILADDR = gabe@example.com |
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
#include <stdio.h> | |
main() { | |
int n[] = {1819043144, 663919}, i; | |
char *c; | |
c = (char*)n; | |
printf("%s", c); |
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
/* Solves one of those triangle shaped peg jumping puzzles. | |
You begin with a board composed of n rows, where the i-th | |
row contains i columns. e.g.: | |
X | |
X X | |
X X X | |
The board begins with pegs in all holes but one. A peg can | |
jump over another peg if it can land in a hole on the other | |
side. The jumped peg is removed. The goal is to finish with | |
a single peg remaining. |
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
From HN thread here: http://news.ycombinator.com/item?id=2222228 | |
Challenge posed here: http://blog.hackensplat.com/2011/02/vinegar.html | |
It seems the cipher is an application of viginere four times. So, if the original | |
17 character key is x1 x2 y1 y2 y3 z1 z2 z3 z4 z5 t1 t2 t3 t4 t5 t6 t7, and the | |
original text is C1 C2 C3 C4, then the ciphertext we're given of IWY SEIX.... | |
can be thought of as follows: | |
I = (C1+x1+y1+z1+t1) | |
W = (C2+x2+y2+z2+t2) |
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
<%= form.select :shipping_method, shipping_methods_for_select(@order) %> |
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
<%= form.select :shipping_method, shipping_methods_for_select(@order) %> |
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
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com | |
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below) | |
module Player | |
describe MovieList, "with optional description" do | |
it "is pending example, so that you can write ones quickly" | |
it "is already working example that we want to suspend from failing temporarily" do | |
pending("working on another feature that temporarily breaks this one") |
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
haha |
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
Model.joins(:relation) | |
.merge(Relation.scope) | |
.count(group: 'column or postgres function', | |
order: 'count_all DESC', | |
limit: 10 | |
) | |
# Note: the count_all is the 'AS' variable ActiveRelation makes for you. |
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
class CreateOrganizations < ActiveRecord::Migration | |
def change | |
create_table :organizations do |t| | |
t.string :name | |
t.boolean :has_octocats | |
t.timestamps | |
end | |
end | |
end |
OlderNewer