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 / timeLimit.sh
Created February 10, 2015 20:16
bash time limit (e.g. used to display dark colours in the evening)
#!/bin/bash
hour=$(date +%H)
if [ "$hour" -lt 20 -a "$hour" -ge 6 ]; then
# execute stuff only between 6am and 8pm
fi

Keybase proof

I hereby claim:

  • I am weiland on github.
  • I am weiland (https://keybase.io/weiland) on keybase.
  • I have a public key whose fingerprint is 4308 B093 7C00 84D8 0C11 B873 2019 4784 B4ED E7DC

To claim this, I am signing this object:

@weiland
weiland / addText.js
Last active August 29, 2015 14:13
text typing animation 2.0
var letters = childrenElement.querySelectorAll('.small');
function writingAnimation() {
var i = 0;
var textTimeout; // Timer Promise obj for the text writing
/**
* addText()
*
@weiland
weiland / blocking-javascript.js
Created January 8, 2015 08:28
example: blocking javascript
var el = document.getElementById( 'text' );
el.innerHTML = "i'm just eating cake";
block(1600);
el.innerHTML = "jk, i am your boss";
function block( ms ) {
var date = new Date();
date.setTime( date.getTime() + ms );
while( (new Date()).getTime() < date.getTime() ) ;
}
@weiland
weiland / small-umd-approach.js
Created December 21, 2014 19:28
small umd js approach
(typeof exports !== "undefined" && exports !== null ? exports : window).moduleName = moduleName;
// just amd missing :(
@weiland
weiland / textWritingAnimation.js
Last active August 29, 2015 14:11
text typing/writing animation
// var letters = angular.element(childrenElement.querySelectorAll('.small'));
/**
* writingAnimation()
*/
function writingAnimation() {
var i = 0;
var textTimeout;
/**
@weiland
weiland / firefox-iframe.html
Created December 14, 2014 19:12
firefox browser frame
<header>
<input id="url">
<button id="go">Go</button>
<button id="stop">Stop</button>
</header>
<iframe src="about:blank" mozbrowser remote></iframe>
@weiland
weiland / inline-worker-cooler-solution.html
Last active August 29, 2015 14:11
Javascript worker without external file (async script execution)
<script type="javascript/worker" id="testWorker">
self.onmessage = function (evt) {
postMessage({
'id': evt.data.id,
'evaluated': eval(evt.data.code)
});
};
</script>
<script>
var url = window.URL || window.webkitURL;
@weiland
weiland / README.md
Last active August 29, 2015 14:10
ES6

Using ES6

compile js code: https://github.com/google/traceur-compiler

in node: node --harmony

in chrome: chrome://flags/#enable-javascript-harmony

@weiland
weiland / trackPageView.js
Created November 28, 2014 12:25
Track PageView in Angular.js
angular.module('app')
.run(function($rootScope, $location, $routeParams, $window){
$rootScope.$on('$routeChangeSuccess', function() {
var params = [];
angular.forEach($routeParams, function(value, key){
params.push(key + '=' + value);
});
var locationPath = $location.path() + '?' + params.join('&');
$window._gaq.push(['_trackPageView', locationPath]);
});