Skip to content

Instantly share code, notes, and snippets.

View stubotnik's full-sized avatar

Stu Gray stubotnik

  • Dublin, Ireland
View GitHub Profile
@stubotnik
stubotnik / comment_counts.rb
Last active January 10, 2018 15:19
tickets API call debug
[{:ticket=>253812, :num_comments=>0},
{:ticket=>253814, :num_comments=>0},
{:ticket=>253901, :num_comments=>0},
{:ticket=>253821, :num_comments=>0},
{:ticket=>253822, :num_comments=>0},
{:ticket=>253845, :num_comments=>0},
{:ticket=>253897, :num_comments=>0},
{:ticket=>253913, :num_comments=>0},
{:ticket=>253929, :num_comments=>0},
{:ticket=>253933, :num_comments=>0},
sudo touch /etc/profile.d/torquebox.sh
echo 'export TORQUEBOX_HOME=/opt/torquebox/torquebox-3.1.1' | sudo tee -a /etc/profile.d/torquebox.sh
echo 'export JBOSS_HOME=$TORQUEBOX_HOME/jboss' | sudo tee -a /etc/profile.d/torquebox.sh
echo 'export JRUBY_HOME=$TORQUEBOX_HOME/jruby' | sudo tee -a /etc/profile.d/torquebox.sh
echo 'export PATH=$JRUBY_HOME/bin:$PATH' | sudo tee -a /etc/profile.d/torquebox.sh
export TORQUEBOX_HOME=/opt/torquebox/torquebox-3.1.1
export JBOSS_HOME=$TORQUEBOX_HOME/jboss
export JRUBY_HOME=$TORQUEBOX_HOME/jruby
Baseline.
joins{runner}.
where{runner.event_id.in [123, 456]}.
update_all("price = runners.price")
# => The multi-part identifier "runners.price" could not be bound
@stubotnik
stubotnik / gist:9942101
Created April 2, 2014 20:09
kill detached rails server
kill -9 $(cat tmp/pids/server.pid)
@stubotnik
stubotnik / gist:9557599
Created March 14, 2014 21:42
simplest rack for static site (page)
use Rack::Static,
:urls => ["/img", "/js"],
:root => "public"
run lambda { |env|
[
200,
{ 'Content-Type' => 'text/html' },
File.open('public/index.html', File::RDONLY)
]
@stubotnik
stubotnik / gist:5685486
Created May 31, 2013 14:46
Crude merge of unspecified number of name, value pairs into context
Handlebars.registerHelper 'merge', (context, args..., options) ->
context[args[i]] = args[i+1] for i in [0...args.length] by 2
options.fn context
@stubotnik
stubotnik / gist:4944088
Last active December 13, 2015 16:59
Auto-populate sign-up. Zh edition.
(function(){
$("#accName").val("ZhTst" + Math.round(Math.random() * 1000000));
$("#pwd, #pwdConfirm").val("ZhTest1234");
$("#securityQuestionID")[0].selectedIndex=1;
$("#securityAnswer").val("櫧櫋瀩櫧櫋瀩");
$("#firstName").val("鶷鷇鶾");
$("#lastName").val("晛桼桾潧潧");
$("#genderMale").attr("checked", true);
$("#birthMonth, #birthDate, #birthYear").each(function(){this.selectedIndex=1;});
$("#state, #city").each(function(){this.selectedIndex=1;});
@stubotnik
stubotnik / gist:4344106
Created December 20, 2012 09:24
curl - http headers + request time
curl -I -w "%{time_total}" www.example.com
load_paths = [
'../this/**/*.rb',
'../that/**/*.rb',
'../other/**/*.rb'
]
load_paths.each do |path|
path = File.join(File.dirname(__FILE__), path)
Dir[path].each do |file|
map('/') {run API::Base}
map('/clients') {run API::Clients}
map('/tech') {run API::Tech}