Skip to content

Instantly share code, notes, and snippets.

View luislee818's full-sized avatar

Dapeng Li luislee818

View GitHub Profile
@luislee818
luislee818 / rspec_cheatsheet_for_zombies.markdown
Created March 9, 2013 13:24
Cheat sheet for RSpec based on CodeSchool's "Testing with RSpec" course

Introduction

Vocabulary

Examples are decalred using the it method
Assertions are called Expectations
should and should_not are called Modifiers
Matchers are the operators in the assertions (==, >, be_true, etc.)

Install RSpec

@luislee818
luislee818 / _vimrc.vim
Created March 31, 2013 06:17
My minimalist vimrc and color scheme
set nocompatible
set hidden " allow unsaved background buffers and remember marks/undo for them
set number " turn on line numbering
set wildmode=longest,list " bash-style tab completion
set autoindent " turn on autoindent
set cursorline " highlight current line
set showmatch " jumps to opening bracket briefly
set hlsearch " turn on highlight for search
@luislee818
luislee818 / command_interpreter.js
Created May 4, 2013 07:48
Simple command line interface in Node.js for Evernote's code challenges on InterviewStreet, below is an example for the CircularBuffer challenge. For some reason it does not work on InterviewStreet, not sure why.
var CommandInterpreter,
AppendCommand;
CommandInterpreter = function () {
};
CommandInterpreter.prototype.reset = function () {
};
CommandInterpreter.prototype.parse = function (input) {
@luislee818
luislee818 / rubytapas_downloader.rb
Created June 14, 2013 02:53
Download RubyTapas episodes and files
require 'httpclient'
require 'nokogiri'
require 'fileutils'
def sanitize_file_name(file_name)
file_name.gsub(/[\*<>\[\]=\+"\\\/:;?]/, '_')
end
LOGIN_URL = 'https://rubytapas.dpdcart.com/subscriber/content'
URL_PREFIX = 'https://rubytapas.dpdcart.com'
@luislee818
luislee818 / app_offline.htm
Created August 20, 2013 05:20 — forked from pitch-gist/gist:2999707
Maintenance page for CUPS
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@luislee818
luislee818 / services.js
Created March 26, 2014 20:54
Define AngularJS services using provider, factory and service
'use strict';
/* Services */
// Demonstrate how to register services
// In this case it is a simple value service.
var servicesModule = angular.module('myApp.services', []).value('version', '0.1');
servicesModule.factory('Foo', function () {
@luislee818
luislee818 / demo.js
Last active August 29, 2015 14:01
JavaScript function call is pass by value (and passed reference by value).
var foo, changeProperty, changeParam;
foo = {
bar: 123
};
changeProperty = function (obj) {
obj.bar = 999;
};
## Prepare ###################################################################
# Remove RVM
rvm implode
# Ensure your homebrew is working properly and up to date
brew doctor
brew update
## Install ###################################################################
@luislee818
luislee818 / 0_reuse_code.js
Last active August 29, 2015 14:06
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
@luislee818
luislee818 / method_as_arg.rb
Created October 29, 2014 14:06
Pass method as argument in Ruby
class Foo
def foo
r = helper method(:bar)
# r = helper Proc.new { bar }
puts r
end
def bar
3
end