Skip to content

Instantly share code, notes, and snippets.

@ryandotsmith
ryandotsmith / Dockerfile
Last active Dec 13, 2016
EC2 Docker Setup
View Dockerfile
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
@ryandotsmith
ryandotsmith / webhooks.js
Last active Jun 20, 2016
Chain.com Webhooks Example
View webhooks.js
/*
Chain's Webhooks system will send an HTTP request
to our app with an event type of 'address-transaction'.
The body of the request will contain Chain's transaction
object. We can use this payload to do whatever we want!
*/
app.post('/', function (req, res) {
if (req.body['event'] == 'address-transaction') {
sendSMS(req.body.transaction)
res.send('OK\n');
@ryandotsmith
ryandotsmith / SimpleChainExample.java
Last active Mar 2, 2016
A simple example of Chain's Java SDK
View SimpleChainExample.java
import com.chain.*;
import java.math.BigInteger;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
public class Main {
private static String projectID = "proj0ACRX7YMG091G";
@ryandotsmith
ryandotsmith / chain-websockets.html
Created Nov 30, 2014
Chain jQuery Notifications Websockets Example
View chain-websockets.html
<!doctype html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>
</head>
<body>
<ul id="thashlist"></ul>
</body>
<script type="text/javascript">
$(function() {
@ryandotsmith
ryandotsmith / crafty.patch
Created Dec 20, 2013
Crafty: remove listener which prevents touchmove events
View crafty.patch
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(-)
View gist:7835702
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
View slope.rb
require 'ostruct'
require 'minitest/autorun'
class P
attr_reader :x, :y
def initialize(x,y)
@x, @y = x, y
end
end
@ryandotsmith
ryandotsmith / new.txt
Last active Dec 21, 2015
Runtime Metrics Changes
View new.txt
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
@ryandotsmith
ryandotsmith / l2met-dashboard.yml
Created Aug 7, 2013
Librato Dashboard Creator
View l2met-dashboard.yml
---
l2met:
default-attributes:
type: gauge
aggregate: true
http.throughput:
http.accept:
summarize_function: sum
group_function: sum
summary_function: count