Skip to content

Instantly share code, notes, and snippets.

View sishen's full-sized avatar

Dingding Ye sishen

View GitHub Profile
@sishen
sishen / Emacs-JSLint
Created January 7, 2011 12:43
Emacs Func: Use ~/bin/jslint4java-1.4.4.jar to automatically JSLint the Javascript file
;;; C-x c calls jslint and outputs to the *compilation* buffer.
(setq jslint-wrapper (concat "java -jar " (substitute-in-file-name "$HOME") "/bin/jslint4java-1.4.4.jar "))
(require 'compile)
(add-hook 'javascript-mode-hook
(lambda ()
(set (make-local-variable 'compilation-read-command) nil)
(set (make-local-variable 'compile-command)
(concat jslint-wrapper buffer-file-name))
(local-set-key (kbd "C-x c") 'compile)))
@dqminh
dqminh / applause_formatter.rb
Last active December 18, 2015 04:59
rspec formatter that applause you when your tests pass
require "rspec/core/formatters/progress_formatter"
class ApplauseFormatter < RSpec::Core::Formatters::ProgressFormatter
def initialize(output)
super(output)
unless File.exists? "/tmp/applause.mp3"
p "Downloading applause for awesomeness"
system "wget http://www.soundjay.com/human/applause-1.mp3 -O /tmp/applause.mp3"
end
end
@jalbertbowden
jalbertbowden / ie-6-9-detect.js
Last active April 7, 2020 10:30 — forked from peteboere/ie-mobile-detect.js
JavaScript IE Version Detection, IE6-10 and IE Mobile
// ----------------------------------------------------------
// A short snippet for detecting versions of IE:
// Uses a combination of object detection and user-agent
// sniffing.
// ----------------------------------------------------------
// If you're not in IE then:
// ie === NaN // falsy
// If you're in IE then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
@dnagir
dnagir / rspec-syntax-cheat-sheet.rb
Created November 5, 2010 09:29
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@cowboy
cowboy / HEY-YOU.md
Last active April 9, 2024 15:54
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.