Skip to content

Instantly share code, notes, and snippets.


Tobias tordans

View GitHub Profile
tordans / google_static_map_helper.rb
Created Oct 17, 2011
Rails Helper to create Google Static Map-Images. Used in
View google_static_map_helper.rb
module GoogleStaticMapHelper
# Creates an image tag for a static google map
# Learn more:
# Code inspired by BillyIII's gmap2ozi
# TODO: Helper so ändern, dass er ein array von Adressen aufnimmt, die dann als Marker angezeigt werden. Alternativ müssen es aber Koordinaten sein...
def static_google_map_image_tag(markers, options = {})
url = ""
tordans / place-url-bookmarklet.js
Created Aug 19, 2011
Bookmarklet: Get a clean, shareable Google Maps Place URL on every Google Maps Place-Page
View place-url-bookmarklet.js
* How to install:
* 1. Open the Firefox or Chrome and Add a new Bookmark-Dialogue
* 2. Copy the line of JS from below and provide whatever name and shortcut-tags you whant
* How to use and test it:
* 1. Search for a place in Google Maps, click on the title to get to the place's details page. This is where google could just place a clean place-url in your browser bar but doen't.
* 2. Click the bookmarklet and the Page reloads so you get a clean google place URL in your browser-bar.
* 3. Jump to your browserbar with cmd+L (strg+L) and press strg+c to copy the clean URL.
tordans / redirect-secondary-domains.php
Created Aug 15, 2011
Script to track secondary domain redirects.
View redirect-secondary-domains.php
// Usage:
// - Configure your secondary domain to open this file/folder.
// - The file will redirect to your primary domain with tracking prameters (Google Analytics used below)
// - Optional: Use those tracking parameters in your primary domain's index-file to set an additional tracking-snippet. See example for details. This step is necessary for stayscout since we use eTracker which does not support campaign-tracking by URL but only by calling a script after the page has been rendered.
// Example:
// -> redirects to and adds this JS+jQuery-code at the end of the body-tag for etracker:
// <!-- Tippfehlerdomain-Tracking -->
// <script type='text/javascript'>
tordans / gist:1101290
Created Jul 23, 2011
iPhone Simulator starten via Terminal
View gist:1101290
# Start iPhone Simulator
/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\\ Simulator
# Start iPhone Simulator with Performance-Debugging on
# See Paul Irish's Talk for details
CA_COLOR_OPAQUE=1 /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\\ Simulator
tordans / data-extractor.html
Created Mar 17, 2011
Quick and dirty JavaScript that exports station-data. Find the final dataset at
View data-extractor.html
<script type="text/javascript" src=""></script>
<h1>Find the final data at</h1>
View ApplyAxureTableStyleToAllTables.bas
Sub ApplyTableStyle()
' ApplyTableStyle Makro
' Weist die ausgewählte Tabellenformatvorlage zu.
' More:
' THX @
Dim t As Table
tordans / application_helper.rb
Created Sep 27, 2010
Eine pragmatische Lösung für das Übersetzungsproblem der Rails Methode distance_of_time_in_words(). Im Deutschen wird je nach Satzbau eine andere Ausgabe benötigt.
View application_helper.rb
# ---
# Code gehört in app/helpers/application_helper.rb (oder einen anderen Helper…)
# ---
# Ausgabe: "Vor mehr als 5 Monaten"/"Vor etwa einem Jahr" — statt "Dauer: mehr als 5 Monate"/"Dauer: etwa 1 Jahr", wie es die Originalfunktion liefert
# Original-File: actionpack/lib/action_view/helpers/date_helper.rb, line 63
# Dokumenation:
# Changelog: I18n.with_options-Scope geändert auf "distance_in_words_gebeugt"
def distance_of_time_in_words_gebeugt(from_time, to_time = 0, include_seconds = false, options = {})
from_time = from_time.to_time if from_time.respond_to?(:to_time)
You can’t perform that action at this time.