Skip to content

Instantly share code, notes, and snippets.

Joe Van Dyk joevandyk

Block or report user

Report or block joevandyk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View bin_packing.rb
require 'active_support'
require 'active_support/core_ext'
require 'ruby-prof'
require "minitest/autorun"
class Array
def rest
View bingo.ts
interface BingoStatus {
won: boolean
interface BingoCell {
number: string,
freebie?: boolean,
completed?: boolean
View gist:755ad84426a1b75cf5f9
Running cd shared/gems/tanga_models && rake test TEST=test/test_exports.rb
/usr/local/tanga/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/minitest-5.3.5/lib/minitest.rb:286: [BUG] vm_call_cfunc - cfp consistency error
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0011 p:---- s:0050 e:000049 CFUNC :each
c:0010 p:0008 s:0047 e:000046 BLOCK /usr/local/tanga/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/minitest-5.3.5/lib/minitest.rb:286
c:0009 p:0036 s:0045 e:000044 METHOD /usr/local/tanga/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/minitest-5.3.5/lib/minitest.rb:317
c:0008 p:0020 s:0038 E:000d38 METHOD /usr/local/tanga/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/minitest-5.3.5/lib/minitest.rb:306
c:0007 p:0062 s:0032 E:001a20 METHOD /usr/local/tanga/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/minitest-5.3.5/lib/minitest.rb:285
View gist:6584c8deffe283573bd3
### Create a table that has name and email, and create a view that versions the way to access the table.
tanga_dev=# create table foos (id serial primary key, name text, email text);
tanga_dev=# create view "1".foos as (select * from foos);
### That's all the code, now we can use http to get, read, update, and delete the data.
$ curl -d '{"name": "bob", "email": ""}' http://localhost:3000/foos
$ curl http://localhost:3000/foos
View test.rb
require 'active_record'
require 'pg'
require 'benchmark'
require 'sequel'
DB = Sequel.connect('postgres://localhost/test')
ActiveRecord::Base.connection.execute <<-SQL
drop table t1 cascade; drop table t2 cascade; drop table t3 cascade;
View gist:0cda77aa7fb4e077447b
[joe@deadlift.local:~] $ ssh tanga
[] $ ls .ssh
authorized_keys config known_hosts
[] $ ssh
View gist:4bdbf5a7a713575a761f
def foo
t = do
sleep 1
puts "finished thread"
puts "exception raised"
puts "ensure called"
View gist:846222a5b76287662786
create table test_table (id serial primary key, name text);
insert into test_table (name) values ('joe'), ('bob');
create schema database_reports;
create table database_reports.queries (
query_id bigserial primary key,
parent_id bigint references database_reports.queries,
View gist:a486f9cebfbb44858796
Site.all.each do |site|
Product.all.each do |product|
Coupon.create site_ids: [], product_ids: []
View gist:1a822d00a10cc7f7118c
diff --git a/config/service_definitions/tanga_rails/run b/config/service_definitions/tanga_rails/run
index 7ba34fc..fd31b8f 100755
--- a/config/service_definitions/tanga_rails/run
+++ b/config/service_definitions/tanga_rails/run
@@ -2,5 +2,6 @@
exec 2>&1
export HOME=/home/monkey
cd $HOME/tanga/sites/tanga
You can’t perform that action at this time.