Skip to content

Instantly share code, notes, and snippets.

View georgi's full-sized avatar

Matthias Georgi georgi

  • Meta
View GitHub Profile
We can't make this file beautiful and searchable because it's too large.
id,date,price,bedrooms,bathrooms,sqft_living,sqft_lot,floors,waterfront,view,condition,grade,sqft_above,sqft_basement,yr_built,yr_renovated,zipcode,lat,long,sqft_living15,sqft_lot15
"7129300520","20141013T000000",221900,3,1,1180,5650,"1",0,0,3,7,1180,0,1955,0,"98178",47.5112,-122.257,1340,5650
"6414100192","20141209T000000",538000,3,2.25,2570,7242,"2",0,0,3,7,2170,400,1951,1991,"98125",47.721,-122.319,1690,7639
"5631500400","20150225T000000",180000,2,1,770,10000,"1",0,0,3,6,770,0,1933,0,"98028",47.7379,-122.233,2720,8062
"2487200875","20141209T000000",604000,4,3,1960,5000,"1",0,0,5,7,1050,910,1965,0,"98136",47.5208,-122.393,1360,5000
"1954400510","20150218T000000",510000,3,2,1680,8080,"1",0,0,3,8,1680,0,1987,0,"98074",47.6168,-122.045,1800,7503
"7237550310","20140512T000000",1.225e+006,4,4.5,5420,101930,"1",0,0,3,11,3890,1530,2001,0,"98053",47.6561,-122.005,4760,101930
"1321400060","20140627T000000",257500,3,2.25,1715,6819,"2",0,0,3,7,1715,0,1995,0,"98003",47.3097,-122.327,2238,6819
"2008000270","20150115T000
@georgi
georgi / delaypixel.js
Last active June 25, 2016 05:28
Delayed PIxel
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');
// Insert Your Facebook Pixel ID below.
fbq('init', 'FB_PIXEL_ID');
@georgi
georgi / ad-creative.py
Created November 4, 2015 14:40
Ad creative
import json
from facebookads import FacebookAdsApi
from facebookads.objects import Ad
from sys import argv
config_file = open('./config.json')
config = json.load(config_file)
config_file.close()
FacebookAdsApi.init(
@georgi
georgi / gist:2c5c11998a3acd2a632d
Created February 5, 2015 17:18
Enumerators and Enumerables
# Iterator methods without blocks are called Enumerators
[1,2,3].each_index # => #<Enumerator: [1, 2, 3]:each_index>
0.upto(10) # => #<Enumerator: 0:upto(10)>
# You can call any Enumerable method on Enumerators
[1,2,3].each_index.map {|i| i + 10 } # => [10, 11, 12]
0.upto(10).map {|i| i + 10 } # => [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
# See documentation about Enumerables
@georgi
georgi / gist:4d51c8712f11d7d38c90
Created February 5, 2015 17:10
String permutations
# Returns all permutations of string s
def permutations(s)
# For single characters just return one solution, the character
if s.size <= 1
[s]
else
# calculate all permutations without the first character
# and then iterate over each
permutations(s[1..-1]).flat_map do |x|
# for each position in permutation x
require "./compiler/crystal/**"
while line = gets
compiler = Crystal::Compiler.new
program = Crystal::Program.new
program.target_machine = compiler.target_machine
prelude = program.normalize(Crystal::Require.new("prelude"))
def self.defer op = nil, callback = nil, &blk
# OBSERVE that #next_tick hacks into this mechanism, so don't make any changes here
# without syncing there.
#
# Running with $VERBOSE set to true gives a warning unless all ivars are defined when
@georgi
georgi / gist:2413562
Created April 18, 2012 13:30
Build output
build () {
local branch=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
local job=soundcloud_${branch}_specs_00$1
local url=http://builder.soundcloud.com/view/All/job/${job}/lastBuild/consoleText
local cwd="\/srv\/hudson\/.jenkins\/jobs\/${job}\/workspace\/"
curl -s $url | sed "/\/usr\/local\/rvm\/.*/d" | sed -e "s/$cwd/.\//"
}
@georgi
georgi / client-side-authentication.rb
Created March 8, 2012 12:37
Facebook Mobile Hack Demo
# Login endpoint for client side flow
# Takes a token paremeter and creates a user if necessary
post "/auth" do
client = Facebook.exchange_token(params[:token])
user = User.from_facebook(client)
session[:user] = user.uid
redirect '/'
end
class Facebook
@georgi
georgi / gist:1865122
Created February 19, 2012 18:44
LINQ in Ruby
class Query
undef select
def method_missing(id, &block)
if block
instance_variable_set("@#{id}", block)
else
instance_variable_get("@#{id}")
end
end
end