Skip to content

Instantly share code, notes, and snippets.

View fredwu's full-sized avatar

Fred Wu fredwu

View GitHub Profile
<?php
public static function masspay($data)
{
$ci = get_instance();
$ci->load->library('zip');
$ci->load->helper('download');
// sort by payment_site then payment_job
$sorted_data = $ci->db->select('wufoo_id')
b = ""
a = Proc.new { b.call() }
b = Proc.new { p "hey" }
a.call()
source 'http://rubygems.org'
# --------------------
# Rails
# --------------------
#gem 'arel', :git => 'git://github.com/rails/arel.git'#, :branch => '1-0-stable'
gem 'rails', '~> 3.0.3'
# gem 'rails', :git => 'git://github.com/rails/rails.git', :branch => '3-0-stable'
# --------------------

Given an integer, and a range of integers (both positive and negative) as input.

We need to calculate the possible combinations of the integers from the range that add up to the given integer.

For example:

Integer: 5

Range: -1, 0, 1, 2, 3, 4

user system total real
erb 0.370000 0.010000 0.380000 ( 0.374381)
slim 0.370000 0.000000 0.370000 ( 0.376008)
haml 2.670000 0.020000 2.690000 ( 2.715564)
mustache 1.220000 0.030000 1.250000 ( 1.255016)
erb (cached) 0.130000 0.000000 0.130000 ( 0.139046)
slim (cached) 0.110000 0.010000 0.120000 ( 0.119379)
haml (cached) 0.300000 0.000000 0.300000 ( 0.302136)
mustache (cached) 0.040000 0.000000 0.040000 ( 0.050540)
@fredwu
fredwu / gist:1124384
Created August 4, 2011 02:31 — forked from mipearson/gist:1124371
Knock Knock!
"Knock Knock!"
Who's there?
...
...
...
"Ruby."
@fredwu
fredwu / gist:3274847
Created August 6, 2012 14:32
ruby/rails wtf
# ruby 1.9.3-p194 + rails 3.2.6
Date.new.step(Date.new, 1.second).map{}
#=> TypeError: expected numeric
Date.new.step(Date.new, 1.second.to_i).map{}
#=> [nil]
Date.new.step(Date.new, 1).map{}
#=> [nil]
# ruby 1.9.2-p290 + rails 3.2.6
@fredwu
fredwu / Locomote-Hiring.md
Created February 13, 2013 01:26
Locomote is hiring!

Hey guys,

At Locomote (http://www.locomote.com.au/) we are building a suite of products in the corporate travel space. 2013 is an exciting year for us as we build, release and improve our products for our first batch of big name clients.

Our work (even though is work in progress) is so ahead of the game that certain competitors of ours are desperatly trying to find out what we are up to by donating their computing power on performing "security checks" on our system.

Following on a series of successes on the commercial front, it is time to grow our tech team again to ensure our competitive advantage. We are looking for a few senior developers to join us on this adventure!

Don't be afraid of the 'corporate' part of our work - apart from dealing with corporate clients, there is actually nothing that resembles the typical corporate image in our daily work at all. For instance, we run agile and educate our clients and partners about our agile process, and our deployment process is streamlined by our chef-based

Keybase proof

I hereby claim:

  • I am fredwu on github.
  • I am fredwu (https://keybase.io/fredwu) on keybase.
  • I have a public key ASA68r0CKvuq4bthSGmC1nbTAqyY9_rIzZTHuo5jdsfxAgo

To claim this, I am signing this object: