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 / .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
@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 / ember-b0rked.js
Last active August 29, 2015 13:57
Paste this in the console of a running ember.js app to detect broken markup
// see https://gist.github.com/raycohen/2296605
// see https://github.com/mahonnaise/b0rked.js
var b0rked = 'https://raw.githubusercontent.com/mahonnaise/b0rked.js/master/b0rked.js';
var script= document.createElement('script');
script.type = 'text/javascript';
script.src = b0rked;
document.head.appendChild(script);
var logIfB0rked = function(s) {
#!/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 / 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)