Skip to content

Instantly share code, notes, and snippets.

@michael-erasmus
michael-erasmus / mine_foursquare.rb
Created December 12, 2013 15:04
Did this for a recent hack day project. This script will take a list of keywords from a csv as input. It then calls the foursquare api to mine location data for that keyword and writes that an output.csv The search_venues call looks for places in Cape Town, but can be tweaked to any location/coordinates. The script will also honour the rate limi…
require 'csv'
require 'foursquare2'
class RateLimit < Faraday::Response::Middleware
@@remaining = 0
def on_complete(env)
@@remaining = env[:response_headers]['x-ratelimit-remaining'].to_i
end
def self.remaining
@chrislawes
chrislawes / gist:7929370
Created December 12, 2013 15:01
Fade in HTML5 Audio tag (jQuery)
var backgroundVolume = 0; // start background volume at 0
$('#main_audio')[0].volume = backgroundVolume; // set volume to 0
$('#main_audio')[0].play(); // start playing tag
var fadeInAudio = setInterval(
function() {
if(backgroundVolume <= 1) // if it's not at 1 (full volume)
{
@lkarsten
lkarsten / default.vcl
Last active April 23, 2021 18:32
varnish vcl for ghost blogging platform
#
# Varnish VCL file for Ghost blogging platform.
# http://ghost.org/
#
# Written for Ghost v0.3.0.
#
# This is a low-hanging-fruit type of VCL. TTL of objects are overridden to 2
# minutes, and everything below /ghost/ is pass()-ed so the user sessions
# work.
#
@willmot
willmot / wordpress.vcl
Created July 4, 2012 15:48
WordPress Varnish VCL
backend default {
.host = "127.0.0.1";
.port = "8444";
}
sub vcl_recv {
# Allow the back-end to serve up stale content if it is responding slowly.
set req.grace = 2m;