Skip to content

Instantly share code, notes, and snippets.

View cange's full-sized avatar

Christian Angermann cange

  • Hamburg, Germany
View GitHub Profile
/*Now the CSS*/
* {margin: 0; padding: 0;}
.tree ul {
padding-top: 20px;
position: relative;
transition: all 0.5s;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
}
.tree li {
/* 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}
@cange
cange / gist:2399485
Created April 16, 2012 15:30
replace all content between double quotes
var text = '<div class="foo" id="bar"></div>';
text.replace(/"[^"]*"/g, '"…"');
// output: '<div class="…" id="…"></div>'
@cange
cange / _sprite_grid.sass
Created January 16, 2012 18:48
Sprite grid position helper SASS
// https://gist.github.com/1622287
// @module sprite grid helper
// default route to the image directory
$spriteGridBasePath: '/images' !default
// default grid size
$spriteGridSize: 16 !default
$spriteGridSizeY: 16 !default
@cange
cange / gist:1559453
Created January 4, 2012 10:22
Media queries detection
/**
* @link http://www.nczonline.net/blog/2012/01/03/css-media-queries-in-javascript-part-1/
* media query detection like this
* if (isMedia("screen and (max-width:800px)") {
* //do something for the screen
* }
*
* if (isMedia("all and (orientation:portrait)")) {
* //react to portrait mode
* }
@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;
}
@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 / gist:1493659
Created December 18, 2011 15:09
Find files containing text
grep -lir "text you want to find" *
@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 / 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;
}