Skip to content

Instantly share code, notes, and snippets.

@scottaj
scottaj / basic_set_ops.rb
Created August 16, 2012 19:42
Set operations
require 'set'
# Union
Set[1,2,3] | Set[3,4,5]
#=> #{1,2,3,4,5}
# Intersection
Set[1,2,3] & Set[2,3,4,5]
#=> #{2,3}
@scottaj
scottaj / tag_scraper.rb
Created November 6, 2012 08:38
HTML Tag Scraper
## Make sure you install nokogiri: 'gem install nokogiri'
require 'nokogiri'
require 'set'
HTML5_TAGS = [
"section", "nav", "article",
"aside", "hgroup", "header",
"footer", "figure", "figcaption",
"data", "time", "mark",
"ruby", "rt", "rp",
@scottaj
scottaj / ST1
Created February 15, 2013 00:42
Evil surround stack traces
STACKTRACE #1:
Result of typing:
cs"
inside of the string:
"yodel"
which was in a ruby-mode buffer that only contained that string.
************ BEGIN STACK TRACE ***************
@scottaj
scottaj / Build.scala
Last active December 16, 2015 19:19
Errors getting scalatest to work with robolectric 1.2.
import sbt._
import Keys._
import AndroidKeys._
object General {
val settings = Defaults.defaultSettings ++ Seq (
name := "BlahBlah",
version := "0.1",
versionCode := 0,
@scottaj
scottaj / init.el
Created May 28, 2013 17:18
My current init.el with custom souces.
;;;;
;; This is the main config file, It is loaded first, automatically by emacs.
;; It firsts downloads and initializes packages, then loads custom user code
;; and settings.
;;;;
;;;;;;
;; Initialize el-get
;;;;;;
@scottaj
scottaj / jquery.js
Last active December 31, 2015 19:49
Make JQuery play nice with Ember Testing
/*!
* jQuery JavaScript Library v1.9.1
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license