Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mchung
mchung / sourcing.io.html
Created February 5, 2014 19:35
Preloading video trick
<div class="preview">
<div class="inner">
<img src="/assets/site/placeholder-4abfbbec6d239b5708837804f8149b32.png">
<video preload="auto">
<source src="https://di3zio5pem6rb.cloudfront.net/site/preview.mp4" type="video/mp4">
<source src="https://di3zio5pem6rb.cloudfront.net/site/preview.ogv" type="video/ogv">
<source src="https://di3zio5pem6rb.cloudfront.net/site/preview.webm" type="video/webm">
</video>
</div>
build_package_patched() {
# These three patches are included when RVM builds REE
cd source
wget 'https://github.com/wayneeseguin/rvm/raw/master/patches/ree/1.8.7/tcmalloc.patch'
wget 'https://github.com/wayneeseguin/rvm/raw/master/patches/ree/1.8.7/stdout-rouge-fix.patch'
wget 'https://github.com/wayneeseguin/rvm/raw/master/patches/ree/1.8.7/no_sslv2.diff'
patch -p1 < tcmalloc.patch
patch -p1 < stdout-rouge-fix.patch
patch -p1 < no_sslv2.diff
cd ..
@mchung
mchung / boot.rb
Created November 12, 2014 17:19
Sinatra: How to use "settings" to inject dependencies
# Setup the Service::Api
Service::Api.set(:environment, :production)
Service::Api.set(:root, Service.root)
Service::Api.set(:service, Service::Provider.new)
stargate:rb mchung$ cat binding.rb
# Return bindings
def f
a = 42
b = "foo"
binding
end
f_vars = f()
# libxml-ruby segfault
require 'rubygems'
require 'xml'
def try(&block)
begin
yield if block_given?
rescue
puts "err: #{$!}"
document.write("oh hai")
class Selfoo
# bar # Why doesn't this work?
def self.foo
puts "foo"
end
class << self
# puts foo # Why doesn't this work?
inputs = args
spec = Gisting::Spec.new
inputs.each do |file_input|
input = spec.add_input
input.file_pattern = file_input
input.map do |map_input|
# 2722 mailbox 2006-05-23 00:08:39
# 217 - 2006-05-23 15:41:48
# 1326 www.crazyradiodeals.com 2006-05-23 18:00:30
# 2722 mailbox 2006-05-23 00:08:39
require 'rubygems'
require 'net/ldap'
# sudo gem install ruby-net-ldap
HOSTNAME = "foo.local"
BASENAME = "dc=openrain,dc=com"
PORT = 389
puts "What's your username"
username = STDIN.readline.chomp
class UsersController < ApplicationController
include Clearance::App::Controllers::UsersController
# Override and add in a check for invitation code
def create
@user = User.new params[:user]
invite_code = params[:invite_code]
@invite = Invite.find_redeemable(invite_code)
if invite_code && @invite