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
class TestModel extends Backbone.Model | |
toJSON: -> | |
_.extend super, | |
success: true | |
json = (new TestModel(test: "success")).toJSON() | |
throw "no super data" unless json.test == "success" |
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 'date' | |
sundays = (1901..2000).reduce(0) do |memo, year| | |
memo + (1..12).count do |month| | |
Date.new(year, month, 1).sunday? | |
end | |
end | |
puts sundays |
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 "capybara" | |
require "capybara/dsl" | |
require 'capybara/poltergeist' | |
Capybara.register_driver :poltergeist do |app| | |
Capybara::Poltergeist::Driver.new(app, :js_errors => false, :phantomjs_options => ['--load-images=no', '--ignore-ssl-errors=yes']) | |
end | |
Capybara.run_server = false | |
Capybara.default_driver = :poltergeist | |
Capybara.javascript_driver = :poltergeist | |
Capybara.current_driver = :poltergeist |
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
BREGMAN: You know ... I once did a piece on this war photographer, his name's Martin Kristofsky. | |
For six months he was with a unit in Vietnam and the day before he was schedule to leave. | |
The day before ... he's out with the unit and it was just a routine patrol or so they thought | |
but suddenly, the Lieutenant pulled him down and Kristophsky hadn't intended to take a picture | |
at that moment but his hands were on the camera and he hit the ground so hard that it just went | |
off. The picture captured the Lieutenant getting shot in the head and Kristophsky said to me, | |
"Well that bullet would of hit me, should of hit me." And he never showed that picture to anyone. | |
Not for 25 years, but 25 years later he got up one morning and he looked at that picture and he | |
saw something that wasn't horrific and he decided to tell the story because he realized that he | |
hadn't accidentally taken a picture of a man dying. It was of a man saving his life. The picture |
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
-- CRAFTY TURTLE + EQUIVALENT EXCHANGE COMPRESSION SCRIPT | |
-- 0.4.1 | |
-- DANIEL EVANS | |
-- LATEST VERSION AT https://gist.github.com/danielevans/5828524 | |
----------------------------------- | |
-- CONFIGURATION | |
----------------------------------- | |
local InSlots = {1,2,5,6} | |
local InDirection = "down"; -- "up" || "down" || "forward" |
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
332-7672 | |
dea rnsa | |
463-8259 | |
gof ucky | |
687-7353 | |
our self |
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
100x requests to the same action performed in sequence via curl | |
# 2.0.0-p0 - Unicorn | |
total time 23.029224000000003 | |
average times 0.23029224000000004 | |
min 0.160939 | |
max 0.368869 | |
# 1.9.3-p392 - Unicorn |
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
;; (setq ediff-make-buffers-readonly-at-startup t) | |
(setq ediff-window-setup-function 'ediff-setup-windows-plain) | |
(setq ediff-split-window-function 'split-window-horizontally) | |
;; Some custom configuration to ediff | |
(defvar my-ediff-bwin-config nil "Window configuration before ediff.") | |
(defcustom my-ediff-bwin-reg ?b | |
"*Register to be set up to hold `my-ediff-bwin-config' |
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
trials = 100_000 | |
results = trials.times.reduce({ :change_successes => 0, :keep_successes => 0 }) do |memo, i| | |
doors = [nil]*3 | |
doors[rand(3)] = "car" | |
choice = rand(3) | |
if doors[choice] == "car" | |
memo[:keep_successes] += 1 | |
else | |
memo[:change_successes] += 1 | |
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
lines = $stdin.read.lines.map &:strip | |
lines = $stdin.read.lines.map do |line| | |
line.strip | |
end | |
while true | |
c,n = lines.shift.split.map &:to_i | |
break if c == 0 && n == 0 | |
v = lines.shift.split.map(&:to_i) |