Skip to content

Instantly share code, notes, and snippets.

Stef Lewandowski stefl

Block or report user

Report or block stefl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@stefl
stefl / scrape_tweets.rb
Created Mar 25, 2012
Download all tweets from the twitter search API for a given search term (limited to their maximum of 1500)
View scrape_tweets.rb
#! /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 Aug 18, 2011
libmxf writeavidmxf options
View gist:1154253
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 Jul 3, 2011
How to get Padrino, Compass and Heroku working without checking in the resulting css to the git repo
View gist:1062414
# 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
Nested postgres transactions in datamapper?
View 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 Mar 26, 2011
extract starting timecode from a video file using mediainfo
View gist:888150
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 Mar 12, 2011
Redirect trailing slashes in Sinatra
View gist:867165
get %r{(.+)/$} do |r| redirect r; end;
@stefl
stefl / gist:812700
Created Feb 5, 2011
Json gem users take note...
View gist:812700
# 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 Jan 27, 2011
carbon coder video timecode inject
View gist:798516
<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>
View Ruby rounding bug using floor on a float
If you do this:
(205.00).floor
You would expect 205.
Likewise with:
(2.05*100).floor
View A quick mashup for Royal Court
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
You can’t perform that action at this time.