View ratings.sql
This file contains 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
begin; | |
create table user_ratings ( | |
id serial primary key, | |
user_id integer not null, | |
rating integer not null check (rating >= 0 and rating <= 5), | |
ratable_id integer not null | |
); | |
create function random_int(max integer) returns integer as $$ |
View bin_packing.rb
This file contains 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 'active_support' | |
require 'active_support/core_ext' | |
require 'ruby-prof' | |
require "minitest/autorun" | |
class Array | |
def rest | |
self[1..-1] | |
end | |
end |
View bingo.ts
This file contains 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
interface BingoStatus { | |
won: boolean | |
} | |
interface BingoCell { | |
number: string, | |
freebie?: boolean, | |
completed?: boolean | |
} |
View gist:7982032
This file contains 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
Aggregate (cost=24840126.64..24840126.65 rows=1 width=6) (actual time=13742.045..13742.046 rows=1 loops=1) | |
-> Seq Scan on orders (cost=0.00..24832943.33 rows=1436662 width=6) (actual time=2447.098..13741.666 rows=95 loops=1) | |
Filter: (SubPlan 1) | |
Rows Removed by Filter: 2884739 | |
SubPlan 1 | |
-> Index Scan using page_views_session_id_created_at_idx on page_views pv (cost=0.57..8.60 rows=1 width=0) (actual ti | |
me=0.003..0.003 rows=0 loops=2884834) | |
Index Cond: ((session_id = orders.session_id) AND (orders.created_on > created_at) AND (created_at > (now() - '2 | |
days'::interval))) | |
Filter: (path = '/carts/resume'::citext) |
View gist:7776710
This file contains 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
Limit (cost=1.58..10202285.08 rows=5 width=4) (actual time=1411.210..1661.481 rows=5 loops=1) | |
-> Unique (cost=1.58..20125024428.69 rows=9863 width=4) (actual time=1411.209..1661.479 rows=5 loops=1) | |
-> Nested Loop (cost=1.58..20125024404.03 rows=9863 width=4) (actual time=1411.209..1661.473 rows=8 loops=1) | |
Join Filter: ((SubPlan 8) IS TRUE) | |
-> Nested Loop (cost=1.29..30771878.73 rows=19726 width=12) (actual time=1360.868..1473.461 rows=8 loops=1) | |
Join Filter: (ci.sku_id = s.id) | |
Rows Removed by Join Filter: 781965 | |
-> Nested Loop Anti Join (cost=1.29..514635.91 rows=19726 width=12) (actual time=1335.537..1347.890 rows=8 loops=1) | |
-> Nested Loop (cost=0.86..476369.46 rows=62559 width=25) (actual time=1329.325..1347.381 rows=14 loops=1) | |
-> Index Scan using cart_items_cart_id_idx on cart_items ci (cost=0.43..183520.84 rows=95690 width=8) (a |
View gist:7621122
This file contains 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
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzEMopbbFvXWydqJMh+GTWL9Q7F1NNtO3jr1J6abk8soAlBa6s+shWglASdfx4Lzb/dYi4fvhLD06wkot5HSRXqeGB1m7IShiEYhRu6+ouAEhBTgPwbV3YunuEAkPTzetJf0bht4FSWVKRxQWuZ1azKnniBlOiHcK1zg+VNpjkBIZF0Qo7tb4YFhB3EO1/3RzCvCK98/Qx01J9BbAU5dtSOjHZAj2z+2G7q7ydVOuM5Y9jBZjZdgKS8VvDVefsOXykgFPZssRaBTFuwsKSfQQ7kGrT5W9lqjm/O9HpnnGmUsOnVHXNGHmO3hyN9CmQs5lm4Dd/A6pSMmYruO+lhP/GQ== joe@laptop |
View gist:7519632
This file contains 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
begin; | |
create table t (something integer); | |
do $$ | |
declare other integer; | |
begin | |
insert into t (something) values (1) returning other into other; | |
end $$ language plpgsql; |
View gist:6892192
This file contains 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
$ DB[:t].insert | |
(0.001143s) INSERT INTO "t" DEFAULT VALUES RETURNING "id" | |
=> 2 |
View gist:6542585
This file contains 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
set -e | |
ulimit -s 20000 | |
cd ~/tanga | |
git fetch origin | |
git reset --hard origin/master | |
bundle | |
rake bundle_dev | |
rake reload_db | |
rake symlink_stuff |
View gist:6016759
This file contains 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
customer_info | |
email_address | |
name (this would be the name on the last billing address used?) | |
necessary to have the last used billing address here? | |
products_ordered | |
email_address | |
product_name | |
quantity | |
date |
NewerOlder