Skip to content

Instantly share code, notes, and snippets.

@wireframe
wireframe / delicious-ubiquity-command.js
Created August 27, 2008 16:01
firefox ubiquity command for posting delicious bookmarks
CmdUtils.CreateCommand({
name: "delicious",
homepage: "http://ryan.codecrate.com/",
author: { name: "Ryan Sonnek", email: "ryan@codecrate.com"},
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.",
@wireframe
wireframe / ImageImagick installation script
Created November 7, 2008 20:18
script to build imagemagick from source
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
@wireframe
wireframe / nginx startup script
Created February 20, 2009 17:22
copy into /etc/init.d/nginx
#! /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.
url = 'http://friendfeed.com/public'
html = HTTParty.get url
doc = Hpricot(html)
doc.search('div').count
CmdUtils.CreateCommand({
name: "zillow",
icon: "http://www.zillow.com/favicon.ico",
homepage: "http://ryan.codecrate.com",
author: { name: "Ryan Sonnek", email: "ryan@codecrate.com"},
license: "MIT",
description: "Search for property value on zillow.com",
help: "select an address and invoke this command",
takes: {"address": noun_arb_text},
@wireframe
wireframe / gist:75088
Created March 6, 2009 21:53
jquery plugin to truncate elements based on height instead of number of 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
@wireframe
wireframe / facebook_style_action.rb
Created November 10, 2010 04:59
use cramp to render layout immediately and use javascript to update placeholders
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"]
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
#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'
@wireframe
wireframe / resque_error_inspector.rb
Created February 2, 2011 17:09
inspect failed resque jobs for particular errors
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