Skip to content

Instantly share code, notes, and snippets.

@pjaspers
pjaspers / universal_image_expander.js
Last active December 31, 2015 22:39
Expand various image providers, without having a lot of duplicate code. Install by hand, like an animal, or use [gasoline](https://github.com/pjaspers/gasoline)
//
// Expand various image providers, without having a lot of duplicate code.
//
// Install by hand, like an animal, or use [gasoline](https://github.com/pjaspers/gasoline)
//
Campfire.UniversalImageExpander = Class.create({
initialize: function(chat) {
this.chat = chat;
this.services = {
dribbble: /^https?:\/\/[www.]?dribbble.com\/shots\/([A-Za-z0-9]+)/,
@pjaspers
pjaspers / gist:7804871
Created December 5, 2013 13:07
25 Movies From 2013 [Source](http://vimeo.com/80862133)
Frances ha
the worlds end
the broken circle breakdown
the bling ring
pain and gain
the great beauty
(kate) blue jasmine
nebraska
beyond the hills
the great gatsby
@pjaspers
pjaspers / gist:7706719
Last active December 29, 2015 17:49
Mojo Top 50 Albums 2013

Source

  1. Bill Callahan - Dream River Standout track: Small Plane
  2. Daft Punk - Random Access Memories Standout track: Get Lucky
  3. David Bowie - The Next Day Standout track: Where Are We Now?
  4. Arctic Monkeys - AM Standout track: R U Mine?
  5. John Grant - Pale Green Ghosts Standout track: Glacier
  6. Deerhunter - Monomania Standout track: Monomania
  7. Mark Kozelek & Jimmy Lavalle - Perils From The Sea Standout track: Gustavo
  8. Vampire Weekend - Modern Vampires Of The City Standout track: Step
def convert_command(command, *args)
args.map! do |word|
if word.is_a?(TrueClass) || word.is_a?(FalseClass)
word ? '1' : '0' # convert bool to 1 or 0
elsif word.is_a?(Range)
if word.end == -1 # negative means to end of range
"#{word.begin}:"
else
"#{word.begin}:#{word.end + (word.exclude_end? ? 0 : 1)}"
end
class Song
# Create a new Song.
#
# path - The spotify path
#
# Returns nothing.
def initialize(options={})
self.path = options[:path] if options[:path]
cache_album_art
end
@pjaspers
pjaspers / gist:7246746
Created October 31, 2013 09:24
Quick way to get a public key into your clipboard.
# Takes a Github Username and copies his/her public key
#
# ghkey pjaspers
#
function ghkey {
if (( $# < 1 ))
then echo "usage: ghkey <username>"; return 1; fi
curl -sL https://github.com/$1.keys | pbcopy
}
@pjaspers
pjaspers / bob_franzlet.js
Last active December 26, 2015 03:59
Bob & Franz bookmarklet Bookmarklet to instantly display Bob & Franz.
// Bob & Franz bookmarklet
//
// Bookmarklet to instantly display Bob & Franz.
//
// Using the Google Closure Compiler to minify the JS:
//
// curl -O -XPOST -d compilation_level=SIMPLE_OPTIMIZATIONS -d output_info=compiled_code -d output_format=text --data-urlencode "[email protected]" http://closure-compiler.appspot.com/compile
//
// Cats should have their own namespace
window.BobFranz = {};
@pjaspers
pjaspers / gist:6761954
Created September 30, 2013 10:30
Propane helper to display cloudup images inline
/*
Display CloudUp images inline.
*/
Campfire.CloudUpExpander = Class.create({
initialize: function(chat) {
this.chat = chat;
var messages = this.chat.transcript.messages;
for (var i = 0; i < messages.length; i++) {
this.detectCloudUpURL(messages[i]);
@pjaspers
pjaspers / gist:6669390
Last active December 23, 2015 17:29
ruby-2.1.0-preview1 changes in code samples.
# def foo now returns a symbol instead of nil, allowing for something like this
class Thing
protected def some;end
protected def like; end
def it; end
protected def hot; end
end
Thing.new.protected_methods
@pjaspers
pjaspers / gist:6624364
Created September 19, 2013 14:29
Joe Armstrong on programmer productivity
Once upon a very long time ago we did a project to compare the efficiency of
Erlang to PLEX.
We implemented "the same things" (TM) in Erlang and PLEX and counted total man hours
We did this for several different things.
Erlang was "better" by a factor of 3 or 25 (in total man hours) - the weighted average was a factor 8
They asked "what is the smart programmer effect"