Skip to content

Instantly share code, notes, and snippets.

View mduvall's full-sized avatar
💡
💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡

Matt DuVall mduvall

💡
💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡
View GitHub Profile
{"yes":"stations","stations":[{"name":"KLYY","desc":"97.5 - La Cumbia Caliente","genre":"Latin","market":"Riverside - San Bernardino, CA","type":"radio","id":"778","tz":"PST","stream":"189001d24c8e78fcf2277c84c39c404c1458fb74","relay":"r2b"},{"name":"KXLM","desc":"102.9 - ","genre":"Latin","market":"Riverside - San Bernardino, CA","type":"radio","id":"2540","tz":"PST","stream":"04556ba4ffac3258ab48aaf0f3b03474c5272f2c","relay":"r2a"},{"name":"KXOL","desc":"96.3 - Latino 96.3","genre":"Latin","market":"Los Angeles, CA","type":"radio","id":"3189","tz":"PST","stream":"9bd1cc714ef4e6e7817f59a99e37b1ae2a3999e3","relay":"r2b"},{"name":"KIIS","desc":"102.7 - The #1 Hit Music Station","genre":null,"market":"Los Angeles, CA","type":"radio","id":"4436","tz":"PST","stream":"b26881d6b3bc02b87635826abc3db76809fe7268","relay":"r2b"},{"name":"KJLH","desc":"102.3 - ","genre":"R&B\/Soul","market":"Los Angeles, CA","type":"radio","id":"7154","tz":"PST","stream":"1eab73420c8ec0c161d1a48080a39ce30a444799","relay":"r2b"},{"name":
@mduvall
mduvall / reddit_saved_stories.py
Created November 10, 2011 20:12
just grab all your saved stories on reddit with python wrapper lib
import reddit, getpass
if __name__ == "__main__":
r = reddit.Reddit(user_agent="test")
user_name = raw_input("User name: ")
password = getpass.getpass("Password: ")
r.login(user=user_name,password=password)
saved_links = r.get_saved_links()
for link in saved_links:
print "Title: " + link.title
@mduvall
mduvall / fade_thing.html
Created November 23, 2011 01:38
test fade input like squareup.com
<html>
<head>
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<style type="text/css">
input#email { z-index:1; height:27px; }
label[for='email_label'] { z-index:0; position:absolute; }
</style>
<script type="text/javascript">
@mduvall
mduvall / with_andand.rb
Created November 30, 2011 22:40
andand call chain, or a crude attempt to
require 'rubygems'
require 'sourcify'
require 'andand'
def with_andand(&blk)
methods = blk.to_source.split("{")[1].split("}")[0].split(".").each { |w| w.strip! }
main_object = methods.first
methods = methods.slice(1,methods.length)
methods.each do |meth|
main_object = eval("#{main_object}.andand.#{meth}")
@mduvall
mduvall / pinterest_gif_loader.js
Created December 8, 2011 18:06
animates boards on pinterest that have gifs, SUCCESS. and a userscript for chrome
$(document).ready(function() {
// grab urls for all the images
var pin_elems = $("a.PinImage");
$.each(pin_elems, function(i,v) {
$.get(v.href, {}, function(data) {
$("img", v).attr("src", $("div#PinImage a", $(data)).attr("href"));
});
});
});
@mduvall
mduvall / curry_up.js
Created January 28, 2012 08:56
partial application in js
// function currying
function curry(fn) {
var s = Array.prototype.slice;
var vargs = s.call(arguments, 1);
return function() {
var nargs = s.call(arguments);
var args = vargs.concat(nargs);
return fn.apply(null, args);
};
@mduvall
mduvall / diff_date.rb
Created April 26, 2012 23:20
Date difference thing for .zshrc
ruby -e "require 'date'; puts \"It's been #{(Date.today - Date.new(2012,01,16)).to_i} days since the beginning\!\""
@mduvall
mduvall / idiom_scraper.rb
Created May 14, 2012 20:57
Scrape a bunch of idioms, or something.
def scrape_all_the_idioms
url = "http://www.learnenglishfeelgood.com/americanidioms/lefgidioms"
idioms = {}
("b".."z").each do |letter|
idioms[letter] = {}
doc = Nokogiri::HTML(open(url + "_" + letter + ".html"))
idiom_definition = 3
doc.css("#content .blue").each do |nodes|
definition = doc.xpath("//*[@id='content']/text()[#{idiom_definition}]")
idioms[nodes.content] = doc.xpath("//*[@id='content']/text()[#{idiom_definition}]").text.strip!
@mduvall
mduvall / Actors.scala
Created May 14, 2012 21:22
Various examples for Scala discussion
import scala.actors._
import scala.actors.Actor._
case object Poke
case object Feed
class Kid() extends Actor {
def act() {
loop {
react {
case Poke => {
@mduvall
mduvall / msv.txt
Created May 21, 2012 18:15
A list of popular metasyntatic variables
These are metasyntatic variables often used in computer programming, people seem to not know about this.
* Foo
* Bar
* Baz
* Qux
* Quux
This is to avoid future questions about: "what's a qux?", "who's actually named Foo Bar?", "Did you mean <some absurd correction>?"