Skip to content

Instantly share code, notes, and snippets.

View cange's full-sized avatar

Christian Angermann cange

  • Hamburg, Germany
View GitHub Profile
@cange
cange / gist:5244692
Created March 26, 2013 11:20
Find file by file type and replace a text in it
find . -name "*.erb" -exec sed -i "s/\t/ /g" {} \;
@cange
cange / gist:4525890
Created January 13, 2013 19:54
Pure JavaScript Flatten Array extension
/**
@see http://tech.karbassi.com/2009/12/17/pure-javascript-flatten-array/
// usage
var given = [[1, [2, [3, [4, [5, [6, [7, [8, [9, [0]]]]]]]]]]];
var value = given.flatten();
'value' => [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
*/
Array.prototype.flatten = function () {
var flat = [],
i = 0,
@cange
cange / css-stats-ack.sh
Created October 4, 2012 17:03 — forked from pjkix/css-stats-ack.sh
shell script to generate some css file statistics
#!/bin/bash
## v1.0.6
## this script will gernerate css stats
### example output
# CSS STATS
# ----------
# Floats: 132
@cange
cange / gist:3776632
Created September 24, 2012 15:47
Cleanup remote branch tree
git remote update --prune
@cange
cange / blueprint.scss
Created September 9, 2012 11:54
Sass written blueprint grid martix
/*
**param:** `$size` value of the whole size of the gradient
**param:** [`$direction`] value of the gradient direction. *default: left (horizontal)*
**param:** [`$color`] basic color value of the grid. *default: black*
**param:** [`$parts`] value of how many sub parts should be splitted the gradient. *default: 1*
*/
@function gridGradient($size, $direction: left, $color: black, $parts: 10) {
$px : percentage(1px / $size);
$colColor : rgba($color, .2);
$middleColor : rgba($color, .1);
@cange
cange / gist:3285593
Created August 7, 2012 14:00
Lists all $PATH entries and drops all duplicates
echo $PATH | awk -F":" '{for (i=1;i<=NF;i++){if (x[$i]++==0) print $i}}'
@cange
cange / dabblet.css
Created June 15, 2012 16:13
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
@cange
cange / dabblet.css
Created May 21, 2012 13:22
How to prevent wrong grid indentation by offset boxed content
/**
* How to prevent wrong grid indentation by offset boxed content
* GRID
*--------------------------------------------------
* Default 940px grid
*/
.mod-floated, .clearfix{ *zoom:1 }
.mod-floated:before,
.clearfix:before,
.mod-floated:after,
/**
* GRID
*--------------------------------------------------
* Default 940px grid
*/
.clearfix{*zoom:1}.clearfix:before,
.clearfix:after{display:table;content:""}
.clearfix:after{clear:both}
[class*="span"]{float:left; margin-left:20px}
.span1{width:60px}.offset1{margin-left:100px}.span2{width:140px}.offset2{margin-left:180px}.span3{width:220px}.offset3{margin-left:260px}.span4{width:300px}.offset4{margin-left:340px}.span5{width:380px}.offset5{margin-left:420px}.span6{width:460px}.offset6{margin-left:500px}.span7{width:540px}.offset7{margin-left:580px}.span8{width:620px}.offset8{margin-left:660px}.span9{width:700px}.offset9{margin-left:740px}.span10{width:780px}.offset10{margin-left:820px}.span11{width:860px}.offset11{margin-left:900px}.span12{width:940px}.offset12{margin-left:980px}
@cange
cange / dabblet.css
Created May 4, 2012 10:56
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;