Skip to content

Instantly share code, notes, and snippets.

View tordans's full-sized avatar

Tobias tordans

View GitHub Profile
@tordans
tordans / chip-de-bestenliste-spalten-löscher.js
Created May 10, 2014 05:23
JavaScript um in der chip.de-Bestenliste Spalten zu löschen
// chip.de/bestenlisten/Bestenliste-Handys--index/detail/id/900/price/400/?f=0300002000010000400000000
$('th.header')
.css('position','relative')
.append('<DIV class="deleter" style="top:0;position:absolute;padding:5px;">x</DIV>');
$('.deleter')
.click( function() {
var $column_index = $(this).parent('th').index() + 1;
$('#mainTable tr').find('td:nth-child('+$column_index+'), th:nth-child('+$column_index+')').remove();
}
);
@tordans
tordans / ApplyAxureTableStyleToAllTables.bas
Created October 11, 2010 13:55
Read more about this macro for Axure Wireframing-Software at http://uxzentrisch.de/tipps-fuer-axure-konzepte/
Sub ApplyTableStyle()
'
' ApplyTableStyle Makro
' Weist die ausgewählte Tabellenformatvorlage zu.
' More: http://uxzentrisch.de/tipps-fuer-axure-konzepte/
'
' THX @ http://www.wordbanter.com/showthread.php?t=142309
'
Dim t As Table
@tordans
tordans / data-extractor.html
Created March 17, 2011 22:52
Quick and dirty JavaScript that exports station-data. Find the final dataset at http://goo.gl/iDo0N
<html>
<body>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.1.min.js"></script>
<h1>Find the final data at http://goo.gl/iDo0N</h1>
<table>
<tr>
<td>Station_ID</td><td>Site_ID</td><td>Site_Name_JP</td><td>Site_Name_EN</td><td>Prefecture_ID</td><td>Prefecture_Name_JP</td><td>Prefecture_Name_EN</td><td>Station</td><td>Station_Name_JP</td><td>-</td><td>Station_Name_EN</td><td>Latitude</td><td>Longitude</td>
@tordans
tordans / gist:1101290
Created July 23, 2011 10:37
iPhone Simulator starten via Terminal
# Start iPhone Simulator
/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator
# Start iPhone Simulator with Performance-Debugging on
# See Paul Irish's Talk http://www.youtube.com/watch?v=q_O9_C2ZjoA#at=830 for details
CA_COLOR_OPAQUE=1 /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator
@tordans
tordans / redirect-secondary-domains.php
Created August 15, 2011 07:33
Script to track secondary domain redirects.
<?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:
// http://staiscout.de -> redirects to https://stayscout.de/?utm_source=tippfehlerdomain&utm_medium=staiscout-de and adds this JS+jQuery-code at the end of the body-tag for etracker:
// <!-- Tippfehlerdomain-Tracking -->
// <script type='text/javascript'>
@tordans
tordans / place-url-bookmarklet.js
Created August 19, 2011 09:49
Bookmarklet: Get a clean, shareable Google Maps Place URL on every Google Maps Place-Page
/**
* 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
tordans / google_static_map_helper.rb
Created October 17, 2011 15:41
Rails Helper to create Google Static Map-Images. Used in StayScout.de
module GoogleStaticMapHelper
# Creates an image tag for a static google map
# Learn more: http://code.google.com/intl/de-DE/apis/maps/documentation/staticmaps/
# Code inspired by BillyIII's gmap2ozi http://github.com/BillyIII/gmap2ozi/tree/master
# 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 = {})
options.symbolize_keys!
url = "http://maps.google.com/maps/api/staticmap"
@tordans
tordans / datetime helper.rb
Created October 24, 2011 17:34
Helpermethods for relative DateTime Stuff in StayScout
# 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: http://apidock.com/rails/v2.3.8/ActionView/Helpers/DateHelper/distance_of_time_in_words
# 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)
to_time = to_time.to_time if to_time.respond_to?(:to_time)
distance_in_minutes = (((to_time - from_time).abs)/60).round
distance_in_seconds = ((to_time - from_time).abs).round
@tordans
tordans / script-console-output-with-log.rb
Created November 15, 2011 18:23
.count vs. .size vs. .lenght
>> p = Project.find_by_id(1114)
# Project Load (1) (0.001019) SELECT * FROM `projects` WHERE (projects.deleted_at IS NULL OR projects.deleted_at > '2011-11-15 18:12:54') ORDER BY projects.id DESC LIMIT 1
=> #<Project id: 1114 …>
>> p.pictures.count
# Always a sql-query
# SQL (1) (0.000572) SELECT count(*) AS count_all FROM `basic_pictures` WHERE (`basic_pictures`.owner_id = 8004 AND `basic_pictures`.owner_type = 'Project') AND ( (`basic_pictures`.`type` = 'ProjectPicture' ) )
=> 60
>> p.pictures.size
@tordans
tordans / http http-diigo.com
Last active December 30, 2017 18:25
diigo.com domain errors
$ http http://diigo.com
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate, post-check=0, pre-check=0
Connection: close
Content-Encoding: gzip
Content-Length: 474
Content-Type: text/html; charset=UTF-8
Date: Sat, 30 Dec 2017 18:21:14 GMT
Expires: Mon, 31 Dec 2001 7:32:00 GMT