Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View stefl's full-sized avatar

Stef Lewandowski stefl

View GitHub Profile
@stefl
stefl / scrape_tweets.rb
Created March 25, 2012 14:47
Download all tweets from the twitter search API for a given search term (limited to their maximum of 1500)
#! /usr/bin/env ruby
require "fileutils"
search_term = ARGV[0]
if search_term
time = Time.now
directory_path = File.dirname(__FILE__) + "/tweets/" + search_term + "_" + time.to_i.to_s
FileUtils.mkdir_p(directory_path)
directory = Dir.new(directory_path)
(1..15).each do |i|
`curl "http://search.twitter.com/search.json?q=#{search_term}&rpp=100&page=#{i}&include_entities=true&result_type=mixed" > #{directory.path}/#{i}.json`
@stefl
stefl / gist:1154253
Created August 18, 2011 15:07
libmxf writeavidmxf options
Options: (options marked with * are required)
-h, --help display this usage message
* --prefix <filename> output filename prefix
--clip <name> clip (MaterialPackage) name.
--project <name> Avid project name.
--tape <name> tape name.
--ntsc NTSC framerate and frame size. Default is DV file frame rate or PAL
--film24 use framerate of 24 instead of default 25fps
--film23.976 use framerate of 23.976 (24000/1001) instead of default 25fps
--legacy use legacy DataDefs, for DV essence use legacy descriptor properties
@stefl
stefl / gist:1062414
Created July 3, 2011 17:45
How to get Padrino, Compass and Heroku working without checking in the resulting css to the git repo
# Enables support for Compass, a stylesheet authoring framework based on SASS.
# See http://compass-style.org/ for more details.
# Store Compass/SASS files (by default) within 'app/stylesheets'
module CompassInitializer
def self.registered(app)
require 'sass/plugin/rack'
Compass.configuration do |config|
config.project_path = Padrino.root
@stefl
stefl / nested-postgres-transactions-in-datamapper
Created May 4, 2011 16:01
Nested postgres transactions in datamapper?
#untested - does this work?
module DataMapper
class Transaction
module DataObjectsAdapter
def nested_transaction_primitive
DataObjects::SavePoint.create_for_uri(normalized_uri, current_connection)
end
end
@stefl
stefl / gist:888150
Created March 26, 2011 09:04
extract starting timecode from a video file using mediainfo
mediainfo -f /files/timecode/528006c9-33b0-4a89-9b94-c9bf7f6be2a9.mov | grep '^Delay.*: [0-9][0-9]:' | awk '{split($0,a,": "); print a[2]}'
@stefl
stefl / gist:867165
Created March 12, 2011 09:58
Redirect trailing slashes in Sinatra
get %r{(.+)/$} do |r| redirect r; end;
@stefl
stefl / gist:812700
Created February 5, 2011 19:25
Json gem users take note...
# Deal with the usual JSON gem idiocy. Guys, come on. I want to serialize an integer, surely this can't be that hard
class Fixnum
def to_json(options = nil)
to_s
end
end
@stefl
stefl / gist:798516
Created January 27, 2011 13:45
carbon coder video timecode inject
<cnpsXML StartTimeCode="00:00:05;00"> <Markers>
<Marker_1 MarkerTime_27MHz.QWD="270000000" MarkerName="Marker1"/>
<Marker_2 MarkerTime_27MHz.QWD="540000000" MarkerName="Marker2"/>
<MyMarker MarkerTime_27MHz.QWD="810000000" MarkerName="MyMarker"/>
</Markers> </cnpsXML>
If you do this:
(205.00).floor
You would expect 205.
Likewise with:
(2.05*100).floor
Here are the commands I used to create http://royalcourt.heroku.com
(Assuming ruby, rubygems, heroku, git)
sudo gem install caboodle
caboodle create royalcourt
cd royalcourt
caboodle kit:add flickr
(input flickr username)
caboodle kit:add twitter