Skip to content

Instantly share code, notes, and snippets.

@tigershen23
tigershen23 / working_lru_cache.rb
Created May 14, 2015 16:35
Tiger's LRU Cache (first pass)
require 'pry-byebug'
# key-value store with a configurable limit
# once it reaches the limit, when a new element is added, discard the
# least recently used element
class LruCache
attr_reader :nodes
def initialize(size_limit)
@tigershen23
tigershen23 / lru_cache.rb
Created May 14, 2015 16:36
Tiger's LRU Cache (refactored)
# key-value store with a configurable limit
# once it reaches the limit, when a new element is added, discard the
# least recently used element
class LruCache
def initialize(size_limit:)
@size_limit = size_limit + 2 # adjust for dummy head and tail
@nodes = {}
set_up_dummy_nodes
@tigershen23
tigershen23 / key_check_lru_cache.rb
Created May 14, 2015 17:54
Tiger's LRU Cache with key checking
# key-value store with a configurable limit
# once it reaches the limit, when a new element is added, discard the
# least recently used element
class LruCache
INVALID_KEYS = ['dummy_head', 'dummy_tail']
def initialize(size_limit:)
@size_limit = size_limit + 2 # adjust for dummy head and tail
@nodes = {}
@tigershen23
tigershen23 / 0_reuse_code.js
Last active August 29, 2015 14:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@tigershen23
tigershen23 / osx-for-hackers.sh
Last active August 29, 2015 14:27 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned. Also, please don't email me about this script, my poor inbox...
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
brew_tap 'caskroom/cask'
brew_install_or_upgrade 'brew-cask'
brew cask install dropbox
brew cask install google-chrome
brew cask install evernote
brew cask install spotify
brew cask install flux
brew cask install macdown
brew cask install iterm2
require 'stats_llc'
require 'pp'
api = StatsLLC::API.new(
api_key: 'NBA_API_KEY',
secret: 'NBA_API_SECRET'
)
puts "fetching 2014-2015 Lakers team information..."
puts
@tigershen23
tigershen23 / .vimrc.before
Created October 10, 2015 01:34
.vimrc.before
let mapleader = ","
inoremap jk <ESC>
vmap '' :w !pbcopy<CR><CR>
inoremap <F2> <c-o>:w<cr>
let g:jsx_ext_required = 0
:set wildignore+=*.o,*.obj,**/node_modules/*
@tigershen23
tigershen23 / .vimrc.after
Created October 10, 2015 01:35
.vimrc.after
colorscheme solarized
let g:jsx_ext_required = 0

Ruby on Rails Website Launch Checklist

Copy this gist and customise it to your liking.

  • Run Brakeman and resolve any issues where required
  • Run rails best practices and resolve any warnings
  • Run full test suite and make sure all tests are passing
  • Make sure no dummy email addresses are left in any notification emails (eg contact form)
  • Make sure production assets compile correct (eg files in vendor, etc, compile and are not 404'ing in production environment)
  • Make sure environment variables are setup correctly (need new Heroku, AWS)