Skip to content

Instantly share code, notes, and snippets.

Alexander Prinzhorn Prinzhorn

Block or report user

Report or block Prinzhorn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Prinzhorn
Prinzhorn / MySQL with .NET
Created Dec 20, 2011
All you basically need to use MySQL with .NET
View 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 / live-sample.js
Created Dec 28, 2011
jQuery-inlog samples
View live-sample.js
$('#about').siblings('h1').add('h2').css('color', '#09f').end().css('text-transform', 'uppercase');
@Prinzhorn
Prinzhorn / dabblet.css
Created Jan 25, 2012
Search form with fading search button
View dabblet.css
/**
* Search form with fading search button
* https://github.com/Prinzhorn
*/
.search {
border:1px solid #444;
display:inline-block;
}
@Prinzhorn
Prinzhorn / js.js
Created Jan 26, 2012
Use jQuery.animate to animate over multiple elements
View js.js
;(function($) {
$.fn.popIn = function(dur) {
var $all = this;
$('<b>').animate({
foobar: $all.length
}, {
easing: 'easeInOutBounce',
duration: dur,
View example.js
/*
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 / switch.js
Created Mar 28, 2012 — forked from substack/switch.js
regex fall-throughs using a switch(true), inspired by @AvianFlu
View switch.js
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 / wooot.js
Created Apr 2, 2012
Revising JavaScript's switch case
View wooot.js
//This is part of a easing function I wrote
function(p, a) {
switch(true) {
case (p <= .5083):
a = 3; break;
case (p <= .8489):
a = 9; break;
case (p <= .96208):
a = 27; break;
case (p <= .99981):
@Prinzhorn
Prinzhorn / LICENSE.txt
Created May 7, 2012 — forked from 140bytes/LICENSE.txt
compress hex color string
View LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Alexander Prinzhorn (@Prinzhorn) https://github.com/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 / example.js
Created May 24, 2012
Sort an array and keep track of all permutations in second array
View example.js
//Sorts arr and syncs assArr simultaneously
var associatedSort = (function() {
var comparator = function(a, b) {
if(a[0] < b[0]) {
return -1;
}
if(a[0] > b[0]) {
return 1;
}
@Prinzhorn
Prinzhorn / bacon.md
Created Sep 19, 2012
Requirements for a MV* framework for small projects
View bacon.md

I just want this a bit cleaner than using plain jQuery.

  • Dynamic view updates like Knockout/o_O
  • With the template syntax of Angular JS (this data-bind="text: bacon" is ridiculous)
  • Models with remote connection. E.g. I want to have a User object with CRUD connection to the server (Angular seems to have this with $resource, but documentation is outdated and I can't get it to work)

I don't need routing. I just want to have clean underlying data connected to the server which updates the view.

Maybe someone can recommend one or maybe two frameworks which solve this. One for the object stuff and another which can handle these objects and updates the view.

You can’t perform that action at this time.