Skip to content

Instantly share code, notes, and snippets.

View jbasdf's full-sized avatar

Justin Ball jbasdf

View GitHub Profile
@jbasdf
jbasdf / sessions.rb
Created January 30, 2012 21:45
Middleware for Sessions in Goliath Options [Click the star to watch this topic]
require 'rack/utils'
require 'rack/session/abstract/id'
require 'remcached'
require 'em-synchrony/em-remcached'
module Slurper
module Rack
class Session < ::Rack::Session::Abstract::ID
include Goliath::Rack::AsyncMiddleware
@jbasdf
jbasdf / sessions.rb
Created February 2, 2012 03:45
Goliath Session Middleware
require 'rack/utils'
require 'rack/session/abstract/id'
require 'remcached'
require 'em-synchrony/em-remcached'
module Slurper
module Rack
class Session < ::Rack::Session::Abstract::ID
include Goliath::Rack::AsyncMiddleware
@jbasdf
jbasdf / iterm2_customize
Created September 12, 2012 21:49
iTerm2 AppleScript
launch "iTerm"
tell application "iTerm"
activate
------------------------------------
-- create the Open Tapestry tabs
tell the first terminal
-- set terminal size
@jbasdf
jbasdf / scan_cameras.rb
Created June 24, 2013 00:00
Output Camera Models for iPhoto
#!/usr/bin/env ruby
require 'rubygems'
require 'exifr'
require 'fileutils'
require 'logger'
class PictureScanner
def self.scan_files(source_dir)
cameras = {}
@jbasdf
jbasdf / ember_models.rake
Created September 28, 2013 17:46
Create Ember.js models from Rails Schema
namespace :ember do
desc "Build ember models from schema"
task :models => :environment do
# Change these values to fit your project
namespace = 'App' # The Ember application's namespace.
output_dir = File.join(Rails.root, "app/assets/javascripts/common/models") # The directory where ember models will be written
schema_file = File.join(Rails.root, 'db/schema.rb')
@jbasdf
jbasdf / ember_models.rake
Created October 1, 2013 23:31
Generate models for Ember Data 1.0.0 beta using Ruby on Rails Schema.
namespace :ember do
desc "Build ember models from schema"
task :models => :environment do
# Change these values to fit your project
namespace = 'App' # The Ember application's namespace.
# The directory where ember models will be written. We drop them
# in the tmp directory since we might not want an ember model for every table in the
@jbasdf
jbasdf / ember_chosen.js
Created October 7, 2013 18:34
Ember.Select using Chosen
App.Chosen = Ember.Select.extend({
multiple: false,
width: '95%',
disableSearchThreshold: 10,
searchContains: true,
attributeBindings:['multiple', 'width', 'disableSearchThreshold', 'searchContains'],
didInsertElement: function(){
this._super();
@jbasdf
jbasdf / inactivity-warning.hbs
Created January 2, 2014 23:09
Handlebars template for Ember inactivity warning component.
<div class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button {{action 'close'}} type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="tmModalLabel">Inactivity Warning</h4>
</div>
<div class="modal-body">
You will be logged out in 30 seconds.
</div>
@jbasdf
jbasdf / dynamodb.json
Created August 23, 2016 22:37
dynamodb.json - cloud formation partial for creating dynamodb tables
{
"Applications" : {
"Type" : "AWS::DynamoDB::Table",
"Properties" : {
"TableName" : "Applications-${stage}",
"AttributeDefinitions": [ {
"AttributeName" : "name",
"AttributeType" : "S"
} ],
"KeySchema": [
@jbasdf
jbasdf / serverless.yml
Last active August 23, 2016 22:38
serverless.yml that includes JSON-REF for creating dynamo db tables
service: lti
provider:
name: aws
runtime: nodejs4.3
iamRoleStatements:
- Effect: "Allow"
Action:
- "dynamodb:Scan"
- "dynamodb:Query"
- "dynamodb:DescribeStream"