This file contains hidden or 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
source "http://rubygems.org" | |
gem 'mcmire-cassandra', require: 'cassandra/1.0' |
This file contains hidden or 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
Braintree::Configuration.tap do |config| | |
if settings = YAML.load_file(Rails.root.join('config', 'braintree.yml'))[Rails.env] | |
config.environment = :sandbox | |
config.merchant_id = settings['merchant_id'] | |
config.public_key = settings['public_key'] | |
config.private_key = settings['private_key'] | |
end | |
end |
This file contains hidden or 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 SearchPlaces(inputSelector) { | |
var input = $(inputSelector).hintInput(), | |
baseUrl = input.attr('data-source'); | |
function currentQuery() { | |
if (input.hasClass('empty')) { | |
return ''; | |
} else { | |
return input.val(); | |
} |
This file contains hidden or 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
if ARGV.size != 2 | |
puts "usage: cassandra_tokens.py <current_size> <new_size>" | |
exit | |
end | |
CURRENT_NODES = ARGV[0].to_i | |
GOING_TO_NODES = ARGV[1].to_i | |
RING_SIZE = 2**127 | |
def tokens(node_count) |
This file contains hidden or 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 'uri' | |
require 'net/http' | |
require 'net/https' | |
module Curl | |
class Easy | |
attr_accessor :uri, :headers, :follow_location, :max_redirects | |
attr_accessor :response, :redirect_count | |
def initialize |
This file contains hidden or 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
Day job: Web/Mobile Developer @ GoTime | |
Your Rails contributions: Gems https://rubygems.org/profiles/2519 | |
What's your Ruby/Rail experience?: 4 years, working almost always with Rails. | |
How do you use GitHub?: Private hosting for work and public hosting for open source |
This file contains hidden or 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
sweet_hash = { | |
foo: "bar", | |
faz: "baz" | |
} |
This file contains hidden or 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_table :foo, :id => false do |t| | |
t.column :id, :manual_pk | |
t.column :bytes, :big_integer | |
end |
This file contains hidden or 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 tag_list | |
self.tags.calculate(:group_concat, :name) | |
end |
This file contains hidden or 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
INSERT INTO tags(name, post_tags_count, created_at, updated_at) VALUES ('latin', utc_timestamp, utc_timestamp, 1) ON DUPLICATE KEY UPDATE updated_at = utc_timestamp, post_tags_count = post_tags_count + 1, id=LAST_INSERT_ID(id) | |
INSERT INTO tags(name, post_tags_count, created_at, updated_at) VALUES ('illegible', utc_timestamp, utc_timestamp, 1) ON DUPLICATE KEY UPDATE updated_at = utc_timestamp, post_tags_count = post_tags_count + 1, id=LAST_INSERT_ID(id) | |
INSERT INTO tags(name, post_tags_count, created_at, updated_at) VALUES ('rails', utc_timestamp, utc_timestamp, 1) ON DUPLICATE KEY UPDATE updated_at = utc_timestamp, post_tags_count = post_tags_count + 1, id=LAST_INSERT_ID(id) | |
SELECT * FROM `tags` WHERE (`tags`.`id` IN (1,2,3) | |
INSERT INTO `posts` (`created_at`, `updated_at`, `text`) VALUES('2008-07-04 23:17:20', '2008-07-04 23:17:20', 'Lorem ipsum dolor sit amet...') | |
INSERT INTO `post_tags` (`tag_id`, `post_id`) VALUES(1, 1) | |
INSERT INTO `post_tags` (`tag_id`, `post_id`) VALUES(2, 1) | |
INSERT INTO `post_tags` (`t |