Skip to content

Instantly share code, notes, and snippets.

View hayeah's full-sized avatar
🕳️
Focusing

blah blah hayeah

🕳️
Focusing
View GitHub Profile
What and How
Where does variation comes from? What is effectiveness?
As engineers, our tendency is to ask "how".
If we can find ways to do things better, we'll win.
TDD helps us to do things better, so we'll win.
def pop(opts={})
queue.pop(opts) do |header,payload|
donkey.process(header,Donkey::Message.decode(payload))
end
end
# Public#pop
it "pops a message" do
header = "header"
/* Prototype JavaScript framework, version 1.6.1
* (c) 2005-2009 Sam Stephenson
*
* Prototype is freely distributable under the terms of an MIT-style license.
* For details, see the Prototype web site: http://www.prototypejs.org/
*
*--------------------------------------------------------------------------*/
var Prototype = {
Version: '1.6.1',
class MQ
attr_reader :current_context
def context(hash)
@current_context ||= {}
begin
old_current_context = @current_context
@current_context = @current_context.merge(hash)
yield
ensure
require 'thread'
queue = Queue.new
workers = 10.times.map do |i|
ts = Thread.new do
loop {
queue.pop.call
Thread.pass
}
require 'thread'
queue = Queue.new
workers = 10.times.map do |i|
ts = Thread.new do
loop {
queue.pop.call
Thread.pass
}
require 'rubygems'
require 'rdiscount'
require 'nokogiri'
$blog = [:blog,
[[:timestamps, "2009-03-17T16:04:34-07:00"],
[:title, "Does Ruby Dream An Eclectic Shell?"],
[:categories, "hack"]],
[[:md,
[],
flet do
def fact(i)
return 1 if i == 1
i * fact(i-1)
end
def fib(i)
return 1 if i == 0
return 1 if i == 1
fib(i-1) + fib(i-2)
module Abbrev
# Given a set of strings, calculate the set of unambiguous
# abbreviations for those strings, and return a hash where the keys
# are all the possible abbreviations and the values are the full
# strings. Thus, given input of "car" and "cone", the keys pointing
# to "car" would be "ca" and "car", while those pointing to "cone"
# would be "co", "con", and "cone".
#
<form action="#{search_path}" data-remote="true" data-type="html">
<div class='section'>
<h2>Dollar Amount Required</h2>
<%= slider(Deal,:dollar_amount_required,:format => "million",:step => 500_000) %>
</div>
<div class='section'>
<h2>Expected IRR</h2>
<%= slider(Deal,:expected_irr,:format => "percent",:step => 50) %>
</div>