Skip to content

Instantly share code, notes, and snippets.

require 'mechanize'
require 'yaml'
$results = []
def find(a, link)
puts "find started on #{link}"
a.get link do |page|
page.search(:css, ".blog-post").each do |post|
h2 = post.search(:css, "h2").first
@defunkt
defunkt / god.rb
Created November 18, 2008 18:04 — forked from mojombo/gist:26183
rails_root = "/data/github/current"
20.times do |num|
God.watch do |w|
w.name = "dj-#{num}"
w.group = 'dj'
w.interval = 30.seconds
w.start = "rake -f #{rails_root}/Rakefile production jobs:work"
w.uid = 'git'
@defunkt
defunkt / gist:449668
Created June 23, 2010 08:55 — forked from dustin/gist:397971
Emacs Lisp to automatically add, commit, and push when files change
;; Automatically add, commit, and push when files change.
(defvar autocommit-dir-set '()
"Set of directories for which there is a pending timer job")
(defun autocommit-schedule-commit (dn)
"Schedule an autocommit (and push) if one is not already scheduled for the given dir."
(if (null (member dn autocommit-dir-set))
(progn
(run-with-idle-timer
@defunkt
defunkt / binary.html
Created October 18, 2012 15:47 — forked from ozmm/binary.html
<!-- http://emilsblog.lerch.org/2009/07/javascript-hacks-using-xhr-to-load.html -->
<html5>
<head>
<script language="vbscript">
Function BinaryArrayToAscCSV( aBytes )
Dim j, sOutput
sOutput = "BinaryArrayToAscCSV"
For j = 1 to LenB(aBytes)
sOutput= sOutput & AscB( MidB(aBytes,j,1) )
puts "What is the amount due?"
total = gets.chomp.to_f
puts "What is the amount tendered?"
paid = gets.chomp.to_f
if paid < total
puts "WARNING: Customer still owes $#{format("%.2f", total-paid)}"
puts Time.now
elsif paid > total
class JobSchedule
# External interface for calling the service
def self.call(object_id, opts={})
if perform_asynchronously?
Delayed::Job.enqueue(EnqueuedJob.new(name, object_id, opts))
else
perform(object_id, opts)
end
end
From c6966ade4141e695159b3b38bdc60a7a82d30775 Mon Sep 17 00:00:00 2001
From: Pieter de Bie <pdebie@ai.rug.nl>
Date: Thu, 25 Sep 2008 22:25:46 +0200
Subject: [PATCH] HistoryView: Add a method to put a commit online
---
GitX.xcodeproj/project.pbxproj | 4 +++
Images/spinner.gif | Bin 0 -> 1924 bytes
PBGitCommit.h | 2 +
PBGitCommit.m | 9 +++++++
@defunkt
defunkt / gist:29879
Created November 28, 2008 02:02 — forked from pjhyett/dedup.rb
#!/usr/bin/ruby
##
# Remove any duplicate tracks in iTunes
# PJ Hyett was here 11/2008
framework "Cocoa"
framework "ScriptingBridge"
itunes = SBApplication.applicationWithBundleIdentifier("com.apple.iTunes")
#!/usr/bin/env ruby
#
# Git log to iCalendar
#
# Written by Dmitry Chestnykh, 5 Aug 2008
# Public domain
#
# Usage:
#
# cd git-repo