Skip to content

Instantly share code, notes, and snippets.

View phaedryx's full-sized avatar
👍
webby goodness

Tad Thorley phaedryx

👍
webby goodness
View GitHub Profile
@rkh
rkh / chat.rb
Created December 14, 2011 12:55
Simple Chat Application using the Sinatra Streaming API
# coding: utf-8
require 'sinatra'
set server: 'thin', connections: []
get '/' do
halt erb(:login) unless params[:user]
erb :chat, locals: { user: params[:user].gsub(/\W/, '') }
end
get '/stream', provides: 'text/event-stream' do
@masonforest
masonforest / gist:4048732
Created November 9, 2012 22:28
Installing a Gem on Heroku from a Private GitHub Repo

Installing a Gem on Heroku from a Private GitHub Repo

Sometimes you want to use a gem on Heroku that is in a private repository on GitHub.

Using git over http you can authenticate to GitHub using basic authentication. However, we don't want to embed usernames and passwords in Gemfiles. Instead, we can use authentication tokens.

  1. Get an OAuth Token from GitHub

First you will need to get an OAuth Token from GitHub using your own username and "note"

@scizo
scizo / nebulabrot.html
Created June 7, 2013 22:24
Nebulabrot forked from Jeremy Ashkenas' Buddhabrot in coffeescript
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<canvas id="buddhabrot" width="1000" height="1000"></canvas>
<div id="images"></div>
<script type="text/javascript">
var canvas = document.getElementById('buddhabrot'),
@theorygeek
theorygeek / error_instrumentation.rb
Created May 7, 2018 16:08
Error Instrumentation
# frozen_string_literal: true
class ErrorInstrumentation
def instrument(type, field)
old_resolver = field.resolve_proc
new_resolver = -> (obj, args, ctx) do
begin # rubocop:disable Style/RedundantBegin
result = old_resolver.call(obj, args, ctx)
if result.is_a?(StandardError)
set_error_context(result, type, obj, field, args, ctx)