Skip to content

Instantly share code, notes, and snippets.


Tobias tordans

View GitHub Profile
rob-murray / console_out.rb
Created Jan 9, 2015
Update a Rails readonly field
View console_out.rb
2.1.5 :020 > User
=> User(id: integer, name: string, email: string, created_at: datetime, updated_at: datetime)
2.1.5 :021 > User.create(name: 'rob', email: '')
(0.1ms) begin transaction
SQL (1.0ms) INSERT INTO "users" ("name", "email", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "rob"], ["email", ""], ["created_at", "2015-01-09 08:50:31.962223"], ["updated_at", "2015-01-09 08:50:31.962223"]]
(0.8ms) commit transaction
=> #<User id: 2, name: "rob", email: "", created_at: "2015-01-09 08:50:31", updated_at: "2015-01-09 08:50:31">
2.1.5 :022 > User.first
User Load (0.3ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
=> #<User id: 2, name: "rob", email: "", created_at: "2015-01-09 08:50:31", updated_at: "2015-01-09 08:50:31">
AndiH /
Last active Aug 29, 2015
Graph generation for a bunch of pictures

Here are Python scripts to generate and analyze and print data of a bunch of pictures. I made them for our scout campsite, at which we generated 1700 pictures with five photographers in the summer of 2014.

You find a write-up in German here:

The scripts are a bit messy. I'm sorry for that.


  • gathers information and saves them into a JSON file
  • reads in this information, does some resorting and stuff, and uses pyplot (with prettyplotlib) to display them
  • looks at three different JSON files of three different years and display some graph.
pmeenan / user-timing-rum.js
Last active Jun 16, 2020
Support routine for adding W3C user timing events to a site. Includes some basic polyfill support for browsers that don't support user timing or navigation timing (though the start time for non-navigation timing support could be improved with IE < 9 to use IE's custom start event).
View user-timing-rum.js
// Support routines for automatically reporting user timing for common analytics platforms
// Currently supports Google Analytics, Boomerang and SOASTA mPulse
// In the case of boomerang, you will need to map the event names you want reported
// to timer names (for mPulse these need to be custom0, custom1, etc) using a global variable:
// rumMapping = {'aft': 'custom0'};
(function() {
var wtt = function(n, t, b) {
t = Math.round(t);
if (t >= 0 && t < 3600000) {
// Google Analytics
marians / database.sql
Created Jul 27, 2011
Snapshot of the script I wrote to generate
View database.sql
CREATE TABLE `stations` (
`id` varchar(9) COLLATE latin1_general_ci NOT NULL,
`postalcode` varchar(5) COLLATE latin1_general_ci NOT NULL,
`name` varchar(255) COLLATE latin1_general_ci NOT NULL,
`longitude` decimal(5,2) NOT NULL,
`latitude` decimal(5,2) NOT NULL,
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci COMMENT='BfS Sensor Stations';
CREATE TABLE `values_2h` (
gr2m / jquery.focus_select.js
Created May 1, 2011
$('input, select').focus_select() will focus the <select> and select the <input>. select does not work on <select>s
View jquery.focus_select.js
jQuery.fn.focus_select = function() {
return this.each(function(){
var $this = jQuery(this);
if ( $'select') ) {
} else {
schacon / gist:942899
Created Apr 26, 2011
delete all remote branches that have already been merged into master
View gist:942899
$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs git push origin --delete
# This script concatenates and minifies a given set of CSS and JavaScript files
# so that only one JS and one CSS file are the result.
# In order to make it work for your project, configure the path settings and the
# file names both for input and output files.
# by Marian Steinbach <>