Skip to content

Instantly share code, notes, and snippets.

@cimm
cimm / AuthorDelegate.qml
Created March 27, 2015 09:02
Nested elements in a QML XmlListModel
import QtQuick 2.0
ListView {
property int parentIndex
height: 20
model: MyXmlListModel{
query: "/papers/paper["+parentIndex+"]/authors/author"
}
@cimm
cimm / gist:250423
Created December 6, 2009 21:14
Creates a github like punch card graphic in SVG
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
<!-- Set the light gray background -->
<rect width="740px" height="330px" style="fill:#efefef"/>
<!-- Set the x axis labels and gridlines -->
<text x="10px" y="30px" font-family="Verdana, sans-serif" font-size="11px" fill="#333">mon</text>
<text x="10px" y="70px" font-family="Verdana, sans-serif" font-size="11px" fill="#333">tue</text>
@cimm
cimm / RepairiPhotoDates.scpt
Created January 16, 2010 23:48
AppleScript that gets the selected photos in iPhoto, extracts the iPhoto date and adds it in the photo EXIF data.
property script_name : "RepairiPhotoDates"
property script_version : "0.2"
property script_description : "Gets the selected photos in iPhoto, extracts the iPhoto date and adds it in the photo EXIF data."
property script_copyright : "Creative Commons Attribution 3.0 License"
property script_author : "Simon Schoeters"
property script_website : "http://www.suffix.be/"
-- Open iPhoto, select the photos you need and run the script, it will replace the date in the EXIF headers with the data iPhoto shows. You'll need ExifTool by Phil Harvey (www.sno.phy.queensu.ca/~phil/exiftool/) installed to make this work.
tell application "iPhoto"
@cimm
cimm / NEMA2KML.scpt
Created January 16, 2010 23:43
This AppleScript converts a NMEA input file and converts all real coordinates to Google placemarks in a KML file.
property script_name : "NMEA2KML"
property script_version : "0.3"
property script_description : "This script converts a NMEA input file and converts all real coordinates to Google placemarks in a KML file."
property script_copyright : "Creative Commons Attribution 3.0 License"
property script_author : "Simon Schoeters"
property script_website : "http://www.suffix.be/"
-- Get the file and its path
set filePath to (choose file with prompt "Select a NMEA file:") as Unicode text
set filePath to replace_chars(filePath, ":", "/")
@cimm
cimm / freemarker.syn
Created January 16, 2010 23:52
TextPad keyword syntax file for Freemarker.
; TextPad keyword syntax file for Freemarker
; Contributed by Simon Schoeters, version 0.2
HTML=1
[Syntax]
Namespace1 = 2
IgnoreCase = Yes
KeyWordLength =
BracketChars = {}[]()
@cimm
cimm / train.rb
Last active September 4, 2015 13:35
Gets the NMBS/SNCB trains leaving from a given station in Belgium.
#!/usr/bin/env ruby
require 'rubygems'
require 'cgi'
require 'open-uri'
require 'hpricot'
current_time = Time.now.strftime("%H:%M")
url = ""
user_agent = "Mozilla/5.0 (X11; U; CrOS i686 9.10.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.253.0 Safari/532.5"
@cimm
cimm / gist:463765
Created July 4, 2010 21:10
Creates an Heroku bundle and downloads the result, removing the old local backup if needed.
#!/usr/bin/env ruby
app = "your-heroku-app"
STDOUT.sync = true
start_time = Time.now
# Prepare old backup for rotate if needed
if File.exist?("#{app}.tar.gz.backup")
puts "\e[31mThe previous backup did not end well, check manually.\e[0m"
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
require 'gnuplot'
if ARGV[0]
source = ARGV[0]
else
puts "usage: ./gpx2image source_file"
exit(0)
@cimm
cimm / gRaphael.js
Created July 28, 2010 18:40
Easiest way to draw a line graph with gRaphael
// Initialize the Raphael object
var r = Raphael("holder");
// Assign the values for the X axis
var x = [1, 2, 3, 4];
// Assign the values for the Y axis
var y = [1, 2, 1, 3];
// Draw a line chart (startX, startY, width, height, valuesX, valuesY)
r.g.linechart(0, 0, 300, 220, x, y);
@cimm
cimm / gist:736953
Created December 10, 2010 22:56
Creates an Heroku dump and downloads the result, removing the old local backup if needed.
#!/usr/bin/env ruby
app = "your-heroku-app"
STDOUT.sync = true
start_time = Time.now
# Fail if the previous dump did not end well
if File.exist?("#{app}.dump.backup")
puts "\e[31mThe previous dump did not end well, check manually.\e[0m"