Skip to content

Instantly share code, notes, and snippets.

View weiland's full-sized avatar
🍫
🎓 && 💻 #GitHubDropICE

Pascal Weiland weiland

🍫
🎓 && 💻 #GitHubDropICE
View GitHub Profile
@weiland
weiland / crontab.sh
Created February 25, 2016 12:51
Daily StandUp Reminder
# Daily StandUp Reminder on weekdays
45 12 * * 1-5 say "StandUp" && terminal-notifier -title "Standup" -message "Get up"
@weiland
weiland / jsonp-promise.js
Created December 11, 2015 12:15
JSONP with Promises
const TIMEOUT = 10000;
function jsonp(url) {
return new Promise((resolve, reject) => {
let callbackName = 'jsonpCallback';
let timeoutTrigger = window.setTimeout(function(){
window[callbackName] = Function.prototype;
reject(new Error('Timeout'));
}, TIMEOUT);
@weiland
weiland / basic-app.haml
Last active September 29, 2015 09:03 — forked from jrmoran/many-directives.haml
AngularJS - precompiled Haml
%html(lang='en' ng-app='app' ng-cloak)
@weiland
weiland / README.md
Created July 21, 2015 07:56
Show current wifi password (on mac)

Show wifi password

SSID="$(networksetup -getairportnetwork en0 | cut -c 24-)"
security find-generic-password -ga $SSID | grep password
@weiland
weiland / README.md
Last active August 29, 2015 14:25
Update outdated npm packages

Update outdated npm packages

First install npm-check-updates

$ npm install npm-check-updates 

Then list outdated dependecies

$ ./node_modules/npm-check-updates/bin/npm-check-updates

@weiland
weiland / railsc-stuff.md
Created July 15, 2015 13:33
Read in json dump of an ActiveRecord object in ruby

read in json dump

Having a Dump of DataSample in json. (maybe replaceing backslashes :s/\\//g (vim))

file = File.read('my_data.json')
json = JSON.parse(file)

json.each { |entry| DataSample.new.form_json(entry.to_json.to_s).save }
@weiland
weiland / berlin-transport-cheat-sheet.md
Last active August 29, 2015 14:22
Berlin Public Transport Cheat Sheet

Berlin Public Transport Cheat Sheet

Platz der Luftbrück -> Berlin Tempelhof S: Alt-Mariendorf ganz hinten

Berlin Tempelhof S -> ZOB/ICC S41 Ring (fast hinten (Treppen))

Platz der Luftbrücke -> Hallesches Tor (zu U1): Alt-Tegel ganz hinten

@weiland
weiland / window.performance.es6
Created May 19, 2015 13:49
window.performance usable metrics
let performance = window.performance;
let perfSupport = !!performance;
/**
* Receive Serve, DomComplete and PageLoaded timings
* @returns {Object}
*/
export function laodTimes() {
if (!perfSupport) {
return;
@weiland
weiland / clone-array.js
Created April 7, 2015 10:31
Clone an Array in JavaScript
// extending the Array prototype
Array.prototype.clone = function clone() {
return this.slice(0);
};
// example
var arr = [4,5];
var copy = arr.slice(0);
// better (since we do not extend the prototype):
@weiland
weiland / browser_metrics.md
Created March 30, 2015 13:36
Browser window metrics

Browser window metrics

Global properties

window.innerWidth
window.innerHeight
window.pageXOffset
window.pageYOffset
document.documentElement.clientWidth
document.documentElement.clientHeight