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 / _grids.sass
Created June 12, 2011 14:04
Sass oocss grid helper
// based on the oocss by stubbornella (Nicole Sullivan)
// @link https://github.com/stubbornella/oocss/blob/master/core/grid/grids.css
// @source https://gist.github.com/1021575
// Definition
=oocss_grid_line
overflow: hidden
*overflow: visible
*zoom: 1
@cange
cange / _helper.sass
Created June 27, 2011 10:44
Some global helper for Sass
// @link https://gist.github.com/1048659
// @module sprite grid helper
// default route to the image directory
$sprite_base_path: '/images' !default
// default grid size
$sprite_icon_size: 16 !default
// @example
// $sprite_icon_size: 16
@cange
cange / gist:1064576
Created July 5, 2011 09:49
Replace with callback in JavaScript
var s = 'hello world!';
function callback (match, index, text) {
console.log(match, index, text);
return match.toUpperCase();
}
s.replace(/l/g, callback);
// output
@cange
cange / cookie.js
Created October 11, 2011 16:45
Cookie get/set/remove
@cange
cange / media.sass
Created October 12, 2011 08:45
Sass oocss media helper
// media
// @link https://github.com/stubbornella/oocss/blob/master/core/media/media.css
=oocss_media_clearfix
overflow: hidden
*overflow: visible
zoom: 1
=oocss_media
.media
+oocss_media_clearfix
@cange
cange / fiddle.css
Created November 12, 2011 16:44
A accordion solution for a table structures
table {
width: 100%;
font-family: Helvetica, Arial, sans-serif
}
table th { font-weight: bold }
table th,
table td {
border: 1px solid #333;
padding: 2px 4px;
}
@cange
cange / fiddle.css
Created November 12, 2011 21:02
An example of how to remove a table row from a table smoothly.
table {
width: 100%;
font-family: Helvetica, Arial, sans-serif
}
table th { font-weight: bold }
table th,
table td {
border: 1px solid #333;
padding: 2px 4px;
-moz-transition: padding .3s;
@cange
cange / gist:1493659
Created December 18, 2011 15:09
Find files containing text
grep -lir "text you want to find" *
@cange
cange / smooscroll.js
Last active September 28, 2015 21:29
Simple smooth scrolling solution
var SmoothScroll = function () {
'use strict';
var self = this,
$topReference = $('html, body'),
$window = $(window)
;
function targetPosition(targetHash) {
@cange
cange / convertArrayToHash.js
Created December 22, 2011 10:13
JavaScript - array to object converter
// var nestedArr = ['a', 'b', 'c', {'foo': 'bar'}];
// convertArrayToHash(nestedArr); // output: {a: 'b', c: {'foo': 'bar'}}
function convertArrayToHash (array) {
var hash = {}, key = '';
$(array).each(function (index, value) {
if (index % 2) {
hash[key] = value;
} else {
key = value;
}