Skip to content

Instantly share code, notes, and snippets.

workin' goodly

Gianni Chiappetta gf3

workin' goodly
View GitHub Profile
View linked_list.c
#include <stdio.h>
#include <stdlib.h>
struct node{
void* data;
struct node* next;
void set_int_value(struct node* node, int val)
gf3 / fold.c
Created Apr 20, 2010 — forked from Veejay/fold.c
Inject in C
View fold.c
#include <stdio.h>
#include <stdlib.h>
struct node{
void* data;
struct node* next;
void set_int_value(struct node* node, int val)
gf3 / comma-first-var.js
Created Apr 9, 2010 — forked from isaacs/comma-first-var.js
A better coding convention for lists and object literals in JavaScript
View comma-first-var.js
// See comments below.
// This code sample and justification brought to you by
// Isaac Z. Schlueter, aka isaacs
// standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog",
gf3 / gist:361449
Created Apr 9, 2010 — forked from paulirish/gist:315916
Everyones favourite closure!
View gist:361449
// everyone's new favorite closure pattern:
(function(window,document,undefined){ ... })(this,this.document);
// when minified:
(function(w,d,u){ ... })(this,this.document);
// which means all uses of window/document/undefined inside the closure
// will be single-lettered, so big gains in minification.
// it also will speed up scope chain traversal a tiny tiny little bit.
gf3 / gist:357155
Created Apr 6, 2010 — forked from paulirish/gist:357048
Average hex colour
View gist:357155
// get the average color of two hex colors.
function avgcolor(color1,color2){
var avg = function(a,b){ return (a+b)/2; },
t16 = function(c){ return parseInt((''+c).replace('#',''),16) },
hex = function(c){ return (c>>0).toString(16) },
hex1 = t16(color1),
hex2 = t16(color2),
r = function(hex){ return hex >> 16 & 0xFF},
g = function(hex){ return hex >> 8 & 0xFF},
b = function(hex){ return hex & 0xFF},
gf3 / gist:349292
Created Mar 30, 2010 — forked from paulirish/gist:274913
jQuery backgroundPosition
View gist:349292
// The CSS property backgroundPosition does not exist in the accessible DOM properties within IE 8.
// this monkeypatch retifies that issue
// usage: $(elem).css('backgroundPosition');
// ticket:
var _css = $.fn.css;
gf3 / prototype-doc-workflow.txt
Created Feb 16, 2010 — forked from dandean/prototype-doc-workflow.txt
Prototype documentation workflow
View prototype-doc-workflow.txt
# Fork sstephenson/prototype on GitHub
# Go to this url and click the fork button. This will create a prototype
# repository under your GitHub account.
View getHtml.fuse.js
(function($, doc) {
var getHTML = function getHTML() {
return $.String(this.raw.outerHTML);
if (!('outerHTML' in doc.documentElement)) {
var dummy = doc.createElement('html');
getHTML = function getHTML() {
var result = dummy.innerHTML;
gf3 / description.txt
Created Dec 18, 2009 — forked from mislav/description.txt
Git Workflow
View description.txt
so my workflow is that each ticket gets a branch. Before merging the branch to master
it needs to be peer-reviewed. So sometimes I have a bunch of branches that are off
being reviewed while I work on something else.
Currently when I run "git branch" I see:
[branch 1]
[branch 2]
[branch 3]
*[branch 4]
[branch 5]