Skip to content

Instantly share code, notes, and snippets.

@mattetti
mattetti / rails_encryptor_reduction.rb
Last active December 29, 2015 16:28
Quick high level rundown showing how Rails 4 sets the message encryptor used for sessions, signed messages and more.
require "active_support"
require "active_support/key_generator"
require "json"
# Based on https://gist.github.com/mattetti/7624413
module JsonSessionSerializer
def self.load(value)
begin
JSON.parse(value)
rescue JSON::ParserError
@rorcraft
rorcraft / crawler.go
Created February 20, 2013 03:02
Golang Tutorial: Crawler
package main
import (
"fmt"
"sync"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
@mhulse
mhulse / Setting up Google Cloud Storage with CORS for Web Fonts.md
Last active August 5, 2023 19:17
Setting up CORS on Google Cloud Storage: An unofficial quick start guide to serving web fonts from Google's cloud. (I'm sure a lot of this info could be improved... Please leave comments if you have tips/improvements.)

Login:

Google Cloud Storage

You'll want to login using an official Google account (i.e. if this is for your company, use the comapany Gmail account vs. a personal one.)

When logging in, you might be prompted to verify the account; if so, enter your cell number to get a verification e-mail or phone call.

Once verified, you'll have to agree to the terms of service; do that, and click continue.

@rorcraft
rorcraft / gist:3967583
Created October 28, 2012 04:56
rubymotion console methods
UIScreen.mainScreen
sessions
app = UIApplication.sharedApplication
delegate = app.delegate
repl(delegate)
quit
@dergachev
dergachev / README.md
Created October 10, 2012 16:49
Vagrant tutorial

Vagrant Setup

This tutorial guides you through creating your first Vagrant project.

We start with a generic Ubuntu VM, and use the Chef provisioning tool to:

  • install packages for vim, git
  • create user accounts, as specified in included JSON config files
  • install specified user dotfiles (.bashrc, .vimrc, etc) from a git repository

Afterwards, we'll see how easy it is to package our newly provisioned VM

@igrigorik
igrigorik / file.html
Created July 6, 2012 08:01
Example of early head flush on load time
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Hello</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
Hello World
</body>
@yuitowest
yuitowest / _hg
Created December 3, 2011 09:51
Zsh completion script for mercurial
#compdef hg
# Zsh completion script for mercurial. Rename this file to _hg and copy
# it into your zsh function path (/usr/share/zsh/site-functions for
# instance)
#
# If you do not want to install it globally, you can copy it somewhere
# else and add that directory to $fpath. This must be done before
# compinit is called. If the file is copied to ~/.zsh.d, your ~/.zshrc
# file could look like this:
@PhilippSoehnlein
PhilippSoehnlein / modernizr-test_position_fixed_ios.js
Created November 3, 2011 12:23
Modernizr Test for position fixed (including iOS tests)
/* modernizr-test_position_fixed_ios.js
* Original by Daniel Ott (https://gist.github.com/1333800)
* 3 March 2011
* Updated by Philipp Söhnlein 3 November 2011
* Custom Tests using Modernizr's addTest API
*/
/* iOS
* There may be times when we need a quick way to reference whether iOS is in play or not.
* While a primative means, will be helpful for that.
@victusfate
victusfate / Gemfile
Created May 10, 2011 00:06 — forked from dodeja/Gemfile
Rails 3.1 Beta 1 on Heroku Working Config
# source 'http://rubygems.org'
source :gemcutter
gem 'rails', '3.1.0.beta1'
# Asset template engines
gem 'json'
gem 'sass'
gem 'coffee-script'
gem 'uglifier'
@wrs
wrs / DeviseJsonAdapter.rb
Created December 8, 2010 18:02
JSON-encoded error and redirect results for Devise controllers
# JSON-encoded error and redirect results for Devise controllers.
# This overrides an internal method of Devise, so be careful when updating Devise!
#
# Usage:
#
# class Users::RegistrationsController < Devise::RegistrationsController
# include DeviseJsonAdapter
# end
#
# devise_for :users, :controllers => { :registrations => "users/registrations" }