Skip to content

Instantly share code, notes, and snippets.

@mwunsch
mwunsch / emoji_replace.js
Created December 15, 2012 04:37
Explorations with emoji replacement in the browser: http://jsfiddle.net/a4JmQ/
/*!
* From: (c) 2012 Steven Levithan <http://slevithan.com/>
* MIT License
*/
if (!String.fromCodePoint) {
/*!
* ES6 Unicode Shims 0.1
* (c) 2012 Steven Levithan <http://slevithan.com/>
* MIT License
*/
@mwunsch
mwunsch / netflix_instant_check.sh
Created December 13, 2012 19:42
JSON response to check for Available movies on Netflix Instant
#! /usr/bin/env bash
movie_title=$(python -c "import urllib; print urllib.quote('''$*''')")
curl -G \
-d "\$filter=substringof('$movie_title',Name)%20and%20Instant/Available" \
-d '$format=json' \
-d '$select=Synopsis,AverageRating,ReleaseYear,BoxArt,Instant,Url,Name' \
"http://odata.netflix.com/Catalog/Titles"
---
state: published
tags: tumblr
date: '2012-10-29 16:42:00 GMT'
format: markdown
slug: tumblr-cli-2
id: 34571571533
type: photo
---
http://24.media.tumblr.com/tumblr_mcnyevcIOH1qzykueo1_1280.jpg
1.9.3p194 :003 > Rack::Utils.build_nested_query "body" => "What the fuck encoding"
=> "body=What+the+fuck+encoding"
1.9.3p194 :004 > Rack::Utils.build_nested_query "body" => Rack::Utils.escape("What the fuck encoding")
=> "body=What%2Bthe%2Bfuck%2Bencoding"
1.9.3p194 :005 > { "body" => Rack::Utils.escape("What the fuck encoding")}
=> {"body"=>"What+the+fuck+encoding"}
1.9.3p194 :006 > require 'uri'
=> true
1.9.3p194 :007 > { "body" => URI.escape("What the fuck encoding")}
=> {"body"=>"What%20the%20fuck%20encoding"}
1.9.3p194 :001 > snowman = "\u2603"
=> "☃"
1.9.3p194 :002 > hash = {"d" => snowman}
=> {"d"=>"☃"}
1.9.3p194 :003 > require 'rack'
=> true
1.9.3p194 :004 > query = Rack::Utils.build_nested_query hash
=> "d=%E2%98%83"
1.9.3p194 :005 > query.encoding
=> #<Encoding:US-ASCII>
1.9.3p194 :001 > keys = [:title, :description]
=> [:title, :description]
1.9.3p194 :002 > values = ["Hello, world", "How are you?", "Personally, I'm fine.", "You're doing terrible?!"]
=> ["Hello, world", "How are you?", "Personally, I'm fine.", "You're doing terrible?!"]
1.9.3p194 :003 > v = values.dup
=> ["Hello, world", "How are you?", "Personally, I'm fine.", "You're doing terrible?!"]
1.9.3p194 :004 > v.fill(keys.length - 1) {|i| values[keys.length - 1, values.length].join("/n") }
=> ["Hello, world", "How are you?/nPersonally, I'm fine./nYou're doing terrible?!", "How are you?/nPersonally, I'm fine./nYou're doing terrible?!", "How are you?/nPersonally, I'm fine./nYou're doing terrible?!"]
1.9.3p194 :005 > keys.zip (v)
=> [[:title, "Hello, world"], [:description, "How are you?/nPersonally, I'm fine./nYou're doing terrible?!"]]
import requests
class Content(object):
def where(self, params={}):
return Query(self).where(params)
def all(self):
return Query(self).all()
class Query(object):
@mwunsch
mwunsch / client.rb
Created April 1, 2012 00:52
Tumblr Client in the next version of the tumblr gem (using Weary v1.0.0
require "weary"
module Tumblr
class Client < Weary::Client
VERSION = "v2"
POST_OPTIONS = [
:state, :tags, :tweet, :date, :markdown, :slug,
:title, :body, # Text posts
:caption, :link, :source, :data, #Photo posts
@mwunsch
mwunsch / gist:1259279
Created October 3, 2011 14:56
ckolderup teaches me irssi
10:54 < ckolderup> I definitely recommend trackbar: http://scripts.irssi.org/scripts/trackbar.pl
10:54 < ckolderup> just drop that in ~/.irssi/scripts and then create a ~/.irssi/scripts/autorun and symlink it in there too
10:57 < ckolderup> if you want to change something in your config file manually while irssi is running and then have that change get picked up, do /reload
10:57 < ckolderup> if it's easier to just make the change to the file instead of figuring out how to change the setting from within irssi and then saving
@mwunsch
mwunsch / Casey.terminal
Created August 20, 2011 01:38
My OS X Lion Terminal Theme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OViRjbGFzc1xOU0NvbG9yU3BhY2VVTlNSR0KAAhAB
TxAnMC4xMDU4ODIzNTI5IDAuMTEzNzI1NDkwMiAwLjExNzY0NzA1ODgA0hAREhNaJGNs
YXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hp