Skip to content

Instantly share code, notes, and snippets.

@GingerBear
GingerBear / gist:de01b810e7edf449271e
Last active August 29, 2015 14:23
style watcher
// ------------------------------------------------------------------------
// In app.js (using connect-assets for assets pipeline)
// ------------------------------------------------------------------------
app.use(require('./style-watcher.js')(app));
// ------------------------------------------------------------------------
@GingerBear
GingerBear / gist:cfd84da0544154bca2e7
Last active August 29, 2015 14:23
fastclick fix demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta http-equiv="cleartype" content="on">
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, width=device-width">
<title>Fastclick test</title>
<script>
@GingerBear
GingerBear / dabblet.css
Created June 2, 2015 22:20
Scrolling shadows by @kizmarh and @LeaVerou
/**
* Scrolling shadows by @kizmarh and @leaverou
* Only works in browsers supporting background-attachment: local; & CSS gradients
* Degrades gracefully
*/
html {
background: white;
font: 120% sans-serif;
}
// save
require('fs').writeFile("/Users/guanxiongding/Desktop/test.html", body, function() {});
// load
body = require('fs').readFileSync('/Users/guanxiongding/Desktop/test.html', {encoding: 'utf8'})
$ = require('bb_platform/node_modules/cheerio').load(body);
@GingerBear
GingerBear / gist:fcec254d414d7134dfe4
Last active August 29, 2015 14:22
convert table tag to div
function tableToDiv(html) {
return html.replace(/<(\/?)(table|thead|tbody|tfoot|th|td|tr)/gi, '<$1div data-original-tag="$2"');
}
#!/usr/bin/env bash
curl https://s3.amazonaws.com/heroku-jvm-buildpack-vi/vim-7.3.tar.gz --output vim.tar.gz
mkdir vim && tar xzvf vim.tar.gz -C vim
export PATH=$PATH:/app/vim/bin
@GingerBear
GingerBear / dabblet.css
Created March 8, 2014 19:41 — forked from anonymous/dabblet.html
Untitled
h3 {
font-size: 15px;
color: #333;
font-family: 'arial';
}
ul {
list-style: none;
padding-left: 0px;
width: 600px;
}
@GingerBear
GingerBear / dabblet.css
Created March 6, 2014 20:35 — forked from anonymous/dabblet.html
vertical and horizontal centering
/* vertical and horizontal centering
method 1: absolute position + negative margin
h1 {
position: absolute;
width: 350px;
height: 50px;
left: 50%;
top: 50%;
@GingerBear
GingerBear / dabblet.css
Created March 6, 2014 20:19
horizontal centering
/* horizontal centering
method 1; negative margin
h1 {
width: 350px;
position: relative;
left: 50%;
margin-left: -175px;
}*/
@GingerBear
GingerBear / url_param.js
Created January 14, 2014 22:47
JavaScript URL parameters parsing by Regular Expression
function url_param(url) {
var _url = url || window.location.href;
var array = _url.match(/\w+=\w+/g);
var result = {};
var tmp = [];
for (var i = 0; i < array.length; i++) {
tmp = array[i].split("=");
result[tmp[0]] = tmp[1];
}