Skip to content

Instantly share code, notes, and snippets.

View elucid's full-sized avatar

Justin Giancola elucid

View GitHub Profile
import Ember from 'ember';
const decoder =
{
4: "A",
7: "B",
5: "C",
9: "D",
6: "E",
8: "F",
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
initialAmount: null,
hasInitialAmount: Ember.computed.gte('initialAmount', 0),
});
@elucid
elucid / async_upload.rb
Created November 21, 2011 21:35
Running multiple Goliath apps
require 'goliath'
require 'yajl'
# adapted from goliath/examples/async_upload.rb
class AsyncUpload < Goliath::API
use Goliath::Rack::Params # parse & merge query and body parameters
use Goliath::Rack::DefaultMimeType # cleanup accepted media types
use Goliath::Rack::Render, 'json' # auto-negotiate response format
def on_headers(env, headers)
@elucid
elucid / .bash_profile
Created March 13, 2017 20:21
fix ssh-agent in OS X sierra
ssh-add -A
class NoActiveRecordController < ActionController::Metal
include Honeybadger::Rack::UserFeedback
include Honeybadger::Rack::ErrorNotifier
include Rack::Sendfile
include ActionDispatch::Static
include Rack::Lock
include Rack::Runtime
include Rack::MethodOverride
include ActionDispatch::RequestId
include RequestStore::Middleware
@elucid
elucid / .profile
Created November 30, 2016 15:56
fix ssh auth sock on tmux attach
# Predictable SSH authentication socket location.
SOCK="/tmp/ssh-agent-$USER-screen"
if test $SSH_AUTH_SOCK && [ $SSH_AUTH_SOCK != $SOCK ]
then
rm -f $SOCK
ln -sf $SSH_AUTH_SOCK $SOCK
export SSH_AUTH_SOCK=$SOCK
fi
@elucid
elucid / .irbrc.rb
Created September 17, 2016 21:05
save useful stuff from IRB sessions
def save_irb(filename)
File.open(filename,'w') {|f| f.puts Readline::HISTORY.entries[0..-2]}
end
#!/usr/bin/env ruby
# usage:
# $ tail -5000 sidekiq.log | ./parse_sidekiq_logs.rb
class Averager
def initialize
@count = 0
@total = 0.0
end
@elucid
elucid / application.controller.js
Last active September 30, 2015 21:08
async computed property experiment
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
@elucid
elucid / migrate.rake
Created May 13, 2011 22:04
wrap transactions in a DDL transaction (if your database supports it)
class << ActiveRecord::Base
def ddl_transaction(&block)
if connection.supports_ddl_transactions?
transaction { block.call }
else
block.call
end
end
end