Skip to content

Instantly share code, notes, and snippets.

View Prinzhorn's full-sized avatar
🌚
Existing

Alexander Prinzhorn Prinzhorn

🌚
Existing
View GitHub Profile
@Prinzhorn
Prinzhorn / switch.js
Created March 28, 2012 15:56
regex fall-throughs using a switch(true), inspired by @AvianFlu
substack : ~ $ node switch.js bleep blah
blah
substack : ~ $ node switch.js for the lose
lose
substack : ~ $ node switch.js for the win
win
substack : ~ $ node switch.js for the fail
fail
substack : ~ $
@Prinzhorn
Prinzhorn / example.js
Created February 27, 2012 18:52
Async forEach
/*
Iterate over all elements and do some async work on each element, but ensure they all get worked on in order
*/
var arr = [1, 2, 3];
asyncForEach(arr, function(next, element) {
console.log(element);
//Simulate async db call
setTimeout(next, 1000);
@Prinzhorn
Prinzhorn / js.js
Created January 26, 2012 22:55
Use jQuery.animate to animate over multiple elements
;(function($) {
$.fn.popIn = function(dur) {
var $all = this;
$('<b>').animate({
foobar: $all.length
}, {
easing: 'easeInOutBounce',
duration: dur,
@Prinzhorn
Prinzhorn / dabblet.css
Created January 25, 2012 13:30
Search form with fading search button
/**
* Search form with fading search button
* https://github.com/Prinzhorn
*/
.search {
border:1px solid #444;
display:inline-block;
}
@Prinzhorn
Prinzhorn / live-sample.js
Created December 28, 2011 16:24
jQuery-inlog samples
$('#about').siblings('h1').add('h2').css('color', '#09f').end().css('text-transform', 'uppercase');
@Prinzhorn
Prinzhorn / MySQL with .NET
Created December 20, 2011 22:46
All you basically need to use MySQL with .NET
using (MySqlDataReader reader = MySqlHelper.ExecuteReader(
"CONNECTION STRING",
"SELECT * FROM my_table WHERE foo=?bar;",
new MySqlParameter("?bar", 1337)/*, more params if needed */)
{
if(!reader.hasRows)
{
//No data
return;
@Prinzhorn
Prinzhorn / dabblet.css
Created December 20, 2011 21:43
Untitled
#box {
width:985px;
height:140px;
background:url(http://style.tutorials.de/v10/small-liveworkshops.jpg) repeat-y 0px 0px;
-moz-animation-duration: 5s;
-moz-animation-name: ticker;
-moz-animation-iteration-count:infinite;
-moz-animation-timing-function:linear;
}
@-moz-keyframes ticker {
@Prinzhorn
Prinzhorn / LICENSE.txt
Created October 4, 2011 17:28 — forked from 140bytes/LICENSE.txt
Tag cloud
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Alexander Prinzhorn
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@Prinzhorn
Prinzhorn / LICENSE.txt
Created October 3, 2011 15:13 — forked from 140bytes/LICENSE.txt
Square root
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@Prinzhorn
Prinzhorn / LICENSE.txt
Created October 3, 2011 08:50 — forked from 140bytes/LICENSE.txt
American Soundex
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE