Skip to content

Instantly share code, notes, and snippets.

View klochner's full-sized avatar

kevin lochner klochner

View GitHub Profile
leads_by_email_hash.each_with_index do |hash, index|
by_name = leads_by_name_hash[index]
if closes_by_email_hash.include?(hash)
out += "#{hash[:community]},#{by_name[:name]},#{hash[:email]},#{sources[index]},X\n"
elsif closes_by_name_hash.include?(by_name)
out += "#{hash[:community]},#{by_name[:name]},#{hash[:email]},#{sources[index]},X\n"
end
end
puts out
#!/usr/bin/ruby
require 'rubygems'
leads = File.read('archstone_leads.csv').lines.collect {|x| x.strip}
closed = File.read('archstone_closed.csv').lines.collect {|x| x.strip}
leads_by_name_hash = []
leads_by_email_hash = []
def history(num=100)
h = Readline::HISTORY.to_a
start = [0,h.size-num-1].max
h.zip((0..h.size).to_a)[start...h.size].each do |e,i|
puts " #{(i).to_s.rjust(4)} #{e}"
end;nil
end
def hg(term)
num=500
h = Readline::HISTORY.to_a
mysql> select count(*) from residents;
+----------+
| count(*) |
+----------+
| 601087 |
+----------+
1 row in set (0.21 sec)
mysql> select count(*) from users;
+----------+
mysql> select count(*) from communities;
+----------+
| count(*) |
+----------+
| 2451 |
+----------+
1 row in set (0.00 sec)
mysql> explain SELECT `communities`.* FROM `communities`
INNER JOIN `residents` on `residents`.`community_id` = communities.id
#!/bin/bash
# Checks the files to be committed for the presence of binding.pry
# The array below can be extended for further checks
checks[1]="binding.pry"
element_count=${#checks[@]}
let "element_count = $element_count + 1"
ROOT_DIR="$(pwd)/"
### Keybase proof
I hereby claim:
* I am klochner on github.
* I am klochner (https://keybase.io/klochner) on keybase.
* I have a public key whose fingerprint is 1934 D31D 2857 BBA4 699C D5EF 5239 6745 C3F7 E0D0
To claim this, I am signing this object:
@klochner
klochner / keybase.md
Created December 9, 2014 05:52
keybase.md
### Keybase proof
I hereby claim:
* I am klochner on github.
* I am klochner (https://keybase.io/klochner) on keybase.
* I have a public key whose fingerprint is BB95 4724 3DDE 55BA 16B3 0923 B9B8 24B2 9462 C374
To claim this, I am signing this object:
function merge(ray1, ray2) {
var out = [];
var index1 = 0;
var index2 = 0;
var length1 = ray1.length;
var length2 = ray2.length;
while (index1 < length1 && index2 < length2) {
var item1 = ray1[index1];
var item2 = ray2[index2];
if (item1 <= item2) {
const merge = (a1, a2) => {
const a22 = a2.slice();
return a1.reduce((out, e) => {
const index = a22.findIndex((i) => {return i > e});
return out.concat(a22.splice(0,index)).concat([e]);
}, []).concat(a22);
}