Skip to content

Instantly share code, notes, and snippets.

View kenmickles's full-sized avatar
🚀

Ken Mickles kenmickles

🚀
View GitHub Profile
@kenmickles
kenmickles / black.coffee
Last active May 26, 2023 18:28
Generate an RSS feed for Henry Rollins' KCRW radio show
request = require('request')
cheerio = require('cheerio')
builder = require('xmlbuilder')
podcast = require('podcast')
_ = require('underscore')
# scrape website for latest episode number
request 'http://www.kcrw.com/music/programs/hr', (err, resp, body) ->
$ = cheerio.load(body)
episodes = []
@kenmickles
kenmickles / foursquare_up.rb
Last active December 15, 2015 01:58
A Ruby script to connect Jawbone Up to Foursquare.
#!/usr/bin/env ruby
##
# This script searches the (unofficial) Jawbone API for new meal checkins and posts
# them to Foursquare. Set your crontab to run it hourly for best results.
#
# I'm kind of hoping Jawbone adds this functionality to the Up app in the near
# future, because, let's be honest, this is pretty kludgy.
#
# `gem install httparty foursquare2` to begin
@kenmickles
kenmickles / foursquare_oauth.php
Created March 17, 2013 19:11
A simple PHP implementation of Foursquare's OAuth 2.0 flow. Useful for quickly getting a test app up and running.
<?php
/**
* This is a quick and dirty implementation of Foursquare's OAuth 2.0 flow. It handles the
* auth redirect and code exchange, and spits out a user access token.
*
* See https://developer.foursquare.com/overview/auth.html for more info.
*
* @author Ken Mickles
*/
@kenmickles
kenmickles / lazy_image_tag.rb
Last active December 14, 2015 07:59
Rails helper method for creating image tags to use with jquery.lazyload.js
def lazy_image_tag(src, options = {})
options["data-original"] = image_path(src)
options[:class] = "lazy #{options[:class]}"
image_tag("lazy.png", options)
end
@kenmickles
kenmickles / gist:4137740
Created November 23, 2012 23:47
Import current eBay auction price into Google Doc
# For an active auction, use:
=IMPORTXML("http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=140888284446", "//span[@itemprop='price']")
# For a completed auction, use:
=IMPORTXML("http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=140888284446", "//span[@class='vi-VR-cvipPrice']")
@kenmickles
kenmickles / gist:4032351
Created November 7, 2012 15:44
Useful shell commands that I'll never remember
# tail log file with timestamp
tail -f log/production.log | awk '{now=strftime("%F %T%z\t");sub(/^/, now);print}' | grep something
# determine when a git branch was created
git show --summary `git merge-base new_map master`
@kenmickles
kenmickles / products.php
Created October 23, 2012 16:28
Array of sample product data
<?php
/*
This file contains a multidimensional array of products that we're using as the data source for our store
*/
$products = array(
array(
@kenmickles
kenmickles / gist:3724929
Created September 14, 2012 21:21
Select MySQL records with non-ASCII characters
SELECT * FROM table WHERE NOT HEX(column) REGEXP '^([0-7][0-9A-F])*$'
@kenmickles
kenmickles / mountain-lion-brew-setup.markdown
Created July 27, 2012 13:32 — forked from myobie/mountain-lion-brew-setup.markdown
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from http://developer.apple.com. You will not be able to submit apps to any stores using this XCode version, so turn away if that is something you might want to do.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@kenmickles
kenmickles / vlc.txt
Created April 12, 2012 01:32
VLC commands used to create the projector display for Jon Tomlinson's birthday party
# ascii art
/Applications/VLC.app/Contents/MacOS/VLC ~/Desktop/Jon.m3u -V caca
# gradient cartoon
/Applications/VLC.app/Contents/MacOS/VLC ~/Desktop/Jon.m3u -Z -L --no-video-deco --no-embedded-video --width=640 --height=360 --mirror-split=0 --gradient-mode=edge --gradient-cartoon --blur-factor=80 --video-filter=mirror:gradient:motionblur
# twilight zones
/Applications/VLC.app/Contents/MacOS/VLC ~/Desktop/Jon.m3u -L --no-video-deco --no-embedded-video --width=640 --height=360 --colorthres-color=16711680 --colorthres-saturationthres=20 --colorthres-similaritythres=15 --rotate-angle=180 --video-filter=colorthres --vout-filter=transform --transform-type=hflip --rate=2.0
/Applications/VLC.app/Contents/MacOS/VLC ~/Desktop/Jon.m3u -L --no-video-deco --no-embedded-video --width=640 --height=360 --colorthres-color=255 --colorthres-saturationthres=20 --colorthres-similaritythres=15 --rotate-angle=180 --video-filter=colorthres --rate=2.0