Skip to content

Instantly share code, notes, and snippets.

@JoshCheek
JoshCheek / implementing_sorbet_example.rb
Created June 4, 2018 13:08
A Ruby runtime type checker based off Stripe's "Sorbet" (https://tinyurl.com/y7tzjutf)
# An implementation to make this code example work: https://tinyurl.com/y7tzjutf
class Sig
def initialize(param_types)
@param_types = param_types
end
def returns(return_type)
@return_type = return_type
self
@tomconte
tomconte / truffle-config.js
Last active July 14, 2019 03:38
Example Truffle 3.0 configuration file to allow deploying contracts to an Azure "Bletchley" Ethereum consortium network. Based on the Truffle docs for Infura (http://truffleframework.com/tutorials/using-infura-custom-provider).
var bip39 = require("bip39");
var ethwallet = require('ethereumjs-wallet');
var ProviderEngine = require("web3-provider-engine");
var WalletSubprovider = require('web3-provider-engine/subproviders/wallet.js');
var Web3Subprovider = require("web3-provider-engine/subproviders/web3.js");
var Web3 = require("web3");
// Insert raw hex private key here, e.g. using MyEtherWallet
var wallet = ethwallet.fromPrivateKey(Buffer.from('abcdef', 'hex'));
@fredbenenson
fredbenenson / kickstarter_sql_style_guide.md
Last active April 2, 2024 15:19
Kickstarter SQL Style Guide
layout title description tags
default
SQL Style Guide
A guide to writing clean, clear, and consistent SQL.
data
process

Purpose

@colindensem
colindensem / elixir_phoenix_app.conf
Created May 24, 2015 11:49
Ubutnu - Upstart - Phoenix - Elixir
#!upstart
#Elixir app is deployed using capistrano v3
#Swap app_name for your application name
description "Service Up - app_name"
author "Colin Densem <hello@summit360.co.uk>"
start on filesystem
@devton
devton / ubuntu_ec2_ruby_2.2.1_setup.sh
Last active August 29, 2015 14:18
ec2 ubuntu ruby 2.2.1 and small fullstack dependencies
echo "installing depencies..."
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev nodejs rbenv ImageMagick libmagickwand-dev build-essential postgresql postgresql-common libpq-dev imagemagick nginx libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev -y
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
if [ ! -d ~/.rbenv/plugins/ruby-build ]; then git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build; fi
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
rbenv install 2.2.1 -s
@dideler
dideler / upgrade-postgres-9.3-to-9.4.md
Last active June 8, 2020 03:24
Upgrading PostgreSQL from 9.3 to 9.4 when upgrading Ubuntu 14.04 to 14.10

TL;DR

Create a backup:

pg_dumpall > mybackup.sql

Perform the upgrade:

sudo pg_dropcluster 9.4 main --stop
@emad-elsaid
emad-elsaid / worm.rb
Created March 19, 2014 12:15
Worm game in under 50 line of code in ruby
#!/usr/bin/env ruby
require 'gosu' # gem install gosu --no-document
include Gosu
$dimension, $splits = 200, 20
$size = $dimension.to_f / $splits.to_f
class Worm
attr_writer :dir
def initialize() reset end
@schickling
schickling / Rakefile
Last active January 31, 2024 23:00
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
@igrigorik
igrigorik / webapp.rb
Created November 13, 2010 21:28
Inspired by @JEG2's talk at Rubyconf... Any ruby object, as a webapp! 'Cause we can. :-)
require 'rubygems'
require 'rack'
class Object
def webapp
class << self
define_method :call do |env|
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?)
[200, {}, send(func, *attrs)]
end
@shripadk
shripadk / gist:552554
Created August 27, 2010 00:59
Setting up Heroku Hostname SSL with GoDaddy SSL Cert
How to setup Heroku Hostname SSL with GoDaddy SSL Certificate and Zerigo DNS
Heroku recently added an exciting new 'Hostname SSL' option. This option offers the broad compatibility of IP-based SSL, but at 1/5 the price ($20 / month at the time of this writing).
The following tutorial explains how to use Heroku's new 'Hostname SSL' option on your Heroku project. Before we begin, let's list what we're using here:
* Heroku Hostname SSL
* GoDaddy Standard SSL Certificate
* Zerigo DNS