Skip to content

Instantly share code, notes, and snippets.

@pjaspers
pjaspers / basicworkflow
Created May 8, 2010 14:33
Git basic workflow
We (http://10to1.be) 're heavy github users so I'm going to inlcude them in the workflow (feel free to replace them with another server).
Github repo is containing the project
1. Make sure you are in the master branch
2. Do a pull.
3. Create a branch to do your work in (git checkout -b "solving_the_bug")
4. Do your work.
5. Switch back to the master branch (git checkout master)
6. Do a pull (git pull) --this to make sure the master branch is up to date.
@pjaspers
pjaspers / gist:388544
Created May 3, 2010 20:27
Check the wk snookerfinal score
#!/usr/bin/env ruby
require 'rubygems'
require 'open-uri'
require 'hpricot'
doc = open("http://news.bbc.co.uk/sport2/hi/other_sports/snooker/8620811.stm") { |f| Hpricot(f) }
puts (doc/"td.storybody").at("p:nth(4)").to_plain_text
Setup zoals ik het voor vader heb gemaakt:
Telenet (POP)
Een nieuwe gmail account (IMAP)
In die gmail account kan je opzetten dat hij ook een POP-account moet leegtrekken (dus ook de nieuwe mail altijd ophaalt). Vanaf nu komt al die Telenet-mail ook binnen op je gmail.
Nu kan je in gmail ook opzetten dat je vanaf een ander adres wilt versturen (dus hier gebruik je terug je Telenet adres als verzender). Nu lijkt het voor de buitenwereld of je op die Telenet account zit maar kan je wel gebruik maken van alle goodies van Gmail (IMAP, degelijke webmail, goede iPhone support) en heb je ook nog als bijkomend voordeel (stel dat je de gmail geheim houdt) dat je heel vlot kunt wisselen van email-adres (je mail blijft dan op hetzelfde (geheime) adres).
@pjaspers
pjaspers / junkiesxl.zsh
Created April 16, 2010 13:14
Autocomplete zsh projects folder
function go() {
if [[ -e ~/development/rails/$1 ]]; then
cd ~/development/rails/$1
elif [[ -e ~/development/sinatra/$1 ]]; then
cd ~/development/sinatra/$1
elif [[ -e ~/development/objc/$1 ]]; then
cd ~/development/objc/$1
elif [[ -e ~/development/php/$1 ]]; then
cd ~/development/php/$1
elif [[ -e ~/development/ruby/$1 ]]; then
def connection(connection, didSendBodyData:bytesWritten, totalBytesWritten:totalBytesWritten, totalBytesExpectedToWrite:totalBytesExpectedToWrite)
puts "Written: #{bytesWritten} TotalBytesWritten: #{totalBytesWritten} TotalBytesExpectedToWrite: #{totalBytesExpectedToWrite}"
puts "Double: #{totalBytesWritten / (totalBytesExpectedToWrite/100)}"
progress_bar.setDoubleValue(totalBytesWritten / (totalBytesExpectedToWrite/100))
end
@pjaspers
pjaspers / my_recipe.rb
Created March 11, 2010 23:49
Notify Campfire of a deploy
require 'etc'
require 'broach'
Capistrano::Configuration.instance(:must_exist).load do
task "notify campfire" do
source_repo_url = repository
deployer = Etc.getlogin
deploying = `git rev-parse HEAD`[0,7]
begin
deployed = previous_revision[0,7]
@pjaspers
pjaspers / words.rails
Created March 10, 2010 22:20
A list of RoR keywords to use with typespeed.
Rails
after_create
after_destroy
after_filter
after_save
after_update
after_validation
after_validation_on_create
after_validation_on_update
alias
@pjaspers
pjaspers / rinari
Created February 16, 2010 10:28
Restart passenger form emacs
;; As seen on
;; http://lucky-dip.net/articles/2009/08/06/restart-passenger-from-emacs-using-rinari/
;; Anyway, here is a small snippet of emacs lisp to easily restart the
;; Passenger server for the project you are currently working on. It
;; assumes you have Rinari installed.
(defun restart-passenger ()
"Restart passenger using the current rinari root" (interactive)
(shell-command (concat "touch " (rinari-root) "tmp/restart.txt"))
(message "Passenger restarted"))
@pjaspers
pjaspers / Random Yegge Bookmarklet
Created December 2, 2009 13:09
Bookmarklet to get a random post from one of Steve yegge's blogs
// javascript:var%20yegge_posts%20=%20new%20Array(%22http://steve-yegge.blogspot.com/2009/05/programmers-view-of-universe-part-3.html%22,%20%22http://steve-yegge.blogspot.com/2009/04/have-you-ever-legalized-marijuana.html%22,%20%22http://steve-yegge.blogspot.com/2009/03/story-time.html%22,%20%22http://steve-yegge.blogspot.com/2008/12/programmers-view-of-universe-part-2.html%22,%20%22http://steve-yegge.blogspot.com/2008/12/fable-ii-arguably-better-than-getting.html%22,%20%22http://steve-yegge.blogspot.com/2008/11/ejacs-javascript-interpreter-for-emacs.html%22,%20%22http://steve-yegge.blogspot.com/2008/10/programmers-view-of-universe-part-1.html%22,%20%22http://steve-yegge.blogspot.com/2008/10/universal-design-pattern.html%22,%20%22http://steve-yegge.blogspot.com/2008/09/bellic-school-of-management-training.html%22,%20%22http://steve-yegge.blogspot.com/2008/09/programmings-dirtiest-little-secret.html%22,%20%22http://steve-yegge.blogspot.com/2008/08/business-requirements-are-bullshit.html%22,%20%22http://steve-y