Skip to content

Instantly share code, notes, and snippets.

View simonreed's full-sized avatar

Simon Reed simonreed

View GitHub Profile
require 'rubygems'
require 'hpricot'
require 'open-uri'
require 'yaml'
doc = Hpricot.parse(open("http://www.lastminute.com"))
destinations = doc.search("select#destination option")
puts "destinations.size #{destinations.size}"
cities = {}
curl -O http://www.ijg.org/files/jpegsrc.v7.tar.gz
tar -zxf jpegsrc.v7.tar.gz
cd jpeg-7/
ln -s `which glibtool` ./libtool
./configure --enable-shared --prefix=/usr/local
make
sudo make install
curl -O ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
tar -zxf ImageMagick.tar.gz
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset=utf-8 />
<title>Citadel</title>
<style></style>
</head>
<body>
<h1>Coming Soon</h1>
<img src="http://www.theotherfiveseconds.com/citadelpictures/citadel.jpg"/>
gem install heroku
git clone git://github.com/simonreed/simonreed.info.git blog
cd blog
heroku create
git push heroku master
var place_id = 'london';
function loadData(place){
// Show place details
}
var head = document.getElementsByTagName('head');
var script = document.createElement('script');
script.id = "nicetripper";
script.src = 'http://www.nicetripper.com/api/places/' + place_id + '?access=b9b2e480192f74f2badd884160299c54&token=f013894cfa980f7fe7c692a03a72e6a4&callback=loadData';
@simonreed
simonreed / rails.rb
Created May 11, 2011 17:06
.watchr/rails.rb
ENV["WATCHR"] = "1"
system 'clear'
def growl(message)
growlnotify = `which growlnotify`.chomp
title = message.include?('0 failures, 0 errors') ? "AWESOMEO" : random_insult
image = message.include?('0 failures, 0 errors') ? "~/.watchr_images/passed.png" : "~/.watchr_images/failed.png"
options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'"
system %(#{growlnotify} #{options} &)
end
@simonreed
simonreed / gist:291f086eb0fd7166aa86
Created February 11, 2015 21:00
dokku v0.3.14 --trace ps:restartall
root@simonreed:~# dokku --trace ps:restartall
+ [[ -f /home/dokku/dokkurc ]]
+ [[ -d /home/dokku/.dokkurc ]]
+ [[ -n 1 ]]
+ set -x
+ parse_args ps:restartall
+ for arg in '"$@"'
+ case "$arg" in
+ return 0
+ for arg in '"$@"'
@simonreed
simonreed / keybase.md
Created November 18, 2015 23:01
keybase.md

Keybase proof

I hereby claim:

  • I am simonreed on github.
  • I am simonreed (https://keybase.io/simonreed) on keybase.
  • I have a public key whose fingerprint is F191 71E1 01E9 EF7B EC3E E63C 5EA5 8A56 1B76 F486

To claim this, I am signing this object:

@simonreed
simonreed / _staff_form.html.erb
Created February 12, 2016 09:53
Using HABTM with a join table.
<%# This will show a list of check_boxes for each service, if the staff has already enabled a service then it will show as checked %>
<%= f.collection_check_boxes(:services_ids, Service.all, :id, :to_s) %>
@simonreed
simonreed / _queries.rb
Last active February 15, 2016 20:40 — forked from chrismahon/_queries.rb
Appointment Scheduler
# Show me all available TimeSlots for a Staff member for a Service on a Day
@staff.time_slots.available.by_date(Date.today)
# Show me all available TimeSlots for a Service on a Day
@service.time_slots.available.by_date(Date.today)
# Show me all available TimeSlots for a Staff member for a Service between 2 Days grouped by Day
@staff.time_slots.available.between_dates(Date.today, Date.today + 5.days).group_by(&:date)
# Show me all available TimeSlots for a Service between 2 Days grouped by Day