Skip to content

Instantly share code, notes, and snippets.

@ryansmith3136
ryansmith3136 / crafty.patch
Created December 20, 2013 16:46
Crafty: remove listener which prevents touchmove events
From 3bfcdec1cfbf155fade70afbb0a8aee91a46d5e3 Mon Sep 17 00:00:00 2001
From: Eric Rykwalder <e.rykwalder@gmail.com>
Date: Thu, 19 Dec 2013 18:38:23 -0800
Subject: [PATCH] fix disableTouch issue on crafty
---
static/libs/crafty.js | 9 ++++++---
static/systems/home.js | 2 ++
2 files changed, 8 insertions(+), 3 deletions(-)
@ryansmith3136
ryansmith3136 / gist:7835702
Created December 7, 2013 00:40
Snake to camel
def s2c(x)
case x
when Hash then Hash[*x.flatten(1).map{|x| s2s(x)}]
when Array then x.map{|x| s2s(x)}
when Symbol then String(x).camelcase
else x
end
end
require 'ostruct'
require 'minitest/autorun'
class P
attr_reader :x, :y
def initialize(x,y)
@x, @y = x, y
end
end
@ryansmith3136
ryansmith3136 / policy.json
Created September 20, 2013 23:10
AWS IAM Read Only
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"autoscaling:Describe*",
"cloudformation:DescribeStacks",
"cloudformation:DescribeStackEvents",
"cloudformation:DescribeStackResources",
"cloudformation:GetTemplate",
@ryansmith3136
ryansmith3136 / Dockerfile
Last active December 13, 2016 10:48
EC2 Docker Setup
FROM ubuntu
MAINTAINER "Bobby Wilson"
RUN apt-get update
RUN apt-get install curl -y
RUN cd /usr/local; curl -O http://nodejs.org/dist/v0.10.16/node-v0.10.16-linux-x64.tar.gz
RUN cd /usr/local; tar xzf node-v0.10.16-linux-x64.tar.gz
ENV PATH /usr/local/bin:/usr/sbin:/bin:/usr/local/node-v0.10.16-linux-x64/bin
ADD . /app
EXPOSE 8000:8000
ENV PORT 8000
@ryansmith3136
ryansmith3136 / new.txt
Last active December 21, 2015 02:29
Runtime Metrics Changes
source=web.1 dyno=heroku.2808254.d97d0ea7-cf3d-411b-b453-d2943a50b456 sample#load_avg_1m=2.46 sample#load_avg_5m=1.06 sample#load_avg_15m=0.99
source=web.1 dyno=heroku.2808254.d97d0ea7-cf3d-411b-b453-d2943a50b456 sample#memory_total=21MB sample#memory_rss=21.22MB sample#memory_cache=0.00MB sample#memory_swap=0.00MB sample#memory_pgin=348836pages sample#memory_pgout=343403pages
@ryansmith3136
ryansmith3136 / l2met-dashboard.yml
Created August 7, 2013 01:35
Librato Dashboard Creator
---
l2met:
default-attributes:
type: gauge
aggregate: true
http.throughput:
http.accept:
summarize_function: sum
group_function: sum
summary_function: count
# A program that works jobs in newly created UNIX
# process by calling fork. The number of processes
# running at any given time is bounded by our use
# of a sized queue.
require 'thread'
# Run at most 4 UNIX processes for any given time.
@limiter = SizedQueue.new(4)
@ryansmith3136
ryansmith3136 / render.rb
Created April 30, 2013 23:47
E.g. Rendering a rails view outside of the controller.
def render_html
dir = Rails.root.join("app", "views", "users")
view = ActionView::Base.new(dir, :user => @user)
view.extend(ApplicationHelper)
view.render(file: 'show', layout: '../layouts/application.html.erb')
end
@ryansmith3136
ryansmith3136 / fernet-lite.rb
Last active December 16, 2015 00:39
fernet-lite
#encoding UTF-8
require 'openssl'
require 'base64'
module FernetLite
MAX_CLOCK_SKEW = 60
VERSION = 0x80
def self.split_key(k)
dec = Base64.urlsafe_decode64(k)