This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from twython import Twython | |
import time | |
twitter = Twython('consumer_key', 'consumer_secret', 'oauth_key', 'oauth_secret') | |
img = open('album_artwork.jpeg', 'rb') | |
filepath = 'tmp/replied_status_ids.txt' | |
while True: | |
mention = twitter.get_mentions_timeline()[0] | |
status_id = mention['id'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! RunTests(filename) | |
" Write the file and run tests for the given filename | |
if filereadable(@%) | |
:wa | |
else | |
:w | |
endif | |
:silent !echo;echo;echo;echo;echo;echo;echo;echo;echo;echo | |
:silent !echo;echo;echo;echo;echo;echo;echo;echo;echo;echo | |
:silent !echo;echo;echo;echo;echo;echo;echo;echo;echo;echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlalchemy.orm | |
sqlalchemy.orm.ScopedSession = sqlalchemy.orm.scoped_session | |
from elixir import * | |
metadata.bind = "postgres://humanure@localhost/humanure_dev" | |
metadata.bind.echo = True | |
class Mention(Entity): | |
status_id = Field(Integer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if match(a:filename, '\.feature$') != -1 | |
exec ":!script/features " . a:filename | |
else | |
if filereadable("script/test") | |
exec ":!script/test " . a:filename | |
elseif filereadable("Gemfile") | |
if match(a:filename, '_test') != -1 | |
exec ":!bundle exec rake test " . a:filename | |
else | |
exec ":!bundle exec rspec --color " . a:filename |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Eader | |
class Document | |
attr_reader :doc | |
def initialize(path) | |
file = open(path) | |
@doc = xml_doc_class.parse(file) | |
end | |
def series |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ShortUrl | |
def self.create(url) | |
url.shortened_hash = first_five_of_sha256(url) | |
url.save | |
end | |
def self.for(url) | |
ENV['HOSTNAME'] + url.shortened_hash | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def config | |
conf = default_config | |
path = 'config/writer.yml' | |
if File.exist?(path) | |
config_file = File.open(path) | |
user_config = YAML.load(config_file) | |
conf = conf.merge(user_config) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'chronic' | |
describe Chronic do | |
def assert_parsed(input, bool = true) | |
(Chronic.parse(input) != nil).should == bool | |
end | |
it "doesn't seem to like timezones" do | |
assert_parsed('11/15/2013 11:56 PST', false) | |
assert_parsed('11/15/2013 11:56 -0400', false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Rehearsal | |
module ViewHelpers | |
def rehearsal_banner(message = nil) | |
return unless rehearsing_with_banner? | |
content_tag :div, :id => 'rehearsal-banner' do | |
if block_given? | |
yield | |
else | |
message || default_message |
OlderNewer