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
CmdUtils.CreateCommand({ | |
name: "delicious", | |
homepage: "http://ryan.codecrate.com/", | |
author: { name: "Ryan Sonnek", email: "[email protected]"}, | |
contributors: ["Ryan Sonnek"], | |
license: "MIT", | |
description: "Tags the current site using delicious", | |
icon: "http://delicious.com/favicon.ico", | |
help: "Save the current url to delicious with the tags input by the user. Any selected text on the page will be recorded as the note.", |
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
sudo yum install libpng -y | |
sudo yum install libpng-devel -y | |
cd /usr/local/src | |
wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz | |
tar xvfz ImageMagick.tar.gz | |
cd ImageMagick-6.4.5 | |
./configure | |
make | |
sudo make install |
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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: skeleton | |
# Required-Start: $local_fs $remote_fs | |
# Required-Stop: $local_fs $remote_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: S 0 1 6 | |
# Short-Description: Example initscript | |
# Description: This file should be used to construct scripts to be | |
# placed in /etc/init.d. |
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
url = 'http://friendfeed.com/public' | |
html = HTTParty.get url | |
doc = Hpricot(html) | |
doc.search('div').count | |
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
CmdUtils.CreateCommand({ | |
name: "zillow", | |
icon: "http://www.zillow.com/favicon.ico", | |
homepage: "http://ryan.codecrate.com", | |
author: { name: "Ryan Sonnek", email: "[email protected]"}, | |
license: "MIT", | |
description: "Search for property value on zillow.com", | |
help: "select an address and invoke this command", | |
takes: {"address": noun_arb_text}, |
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
/* | |
truncates elements that pass a certain height. | |
adds a "view more" link to display the rest of the content. | |
a different approach than standard truncation which relies on character counting. | |
character counting may not be desireable when elements have short words, but a | |
number of line breaks. | |
usage: | |
//using defaults |
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 'rubygems' | |
require 'cramp/controller' | |
class WelcomeAction < Cramp::Controller::Action | |
periodic_timer :send_updates, :every => 3 | |
def start | |
@counter = 0 | |
render ["<html><body><h1 id='placeholder'>Content goes here</h1>", "\n"] | |
render ["<div>testing</div>" * 200, "\n"] |
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 BlogTest < Test::Unit::TestCase | |
register_fixture :a_basic_user do | |
User.new | |
end | |
register_fixture :a_basic_blog do | |
Blog.new | |
end | |
with :a_basic_user, :a_basic_blog do | |
setup 'executing @a_basic_user.do_something' do |
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
#convert backpack export into evernote import | |
require 'rubygems' | |
require 'hpricot' | |
require 'builder' | |
require 'time' | |
import_file = '/path/to/backpack-export.xml' | |
export_file = '/path/to/my_evernote_import.enex' |
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
start = 0 | |
max = Resque.redis.llen(:failed).to_i | |
count = 100 | |
errors = [] | |
while start < max | |
Resque.list_range(:failed, start, count).each do |e| | |
errors << e if e['payload']['args'].first == 'User' | |
end | |
start += count | |
end |
OlderNewer