Skip to content

Instantly share code, notes, and snippets.

@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 / 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 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;
}
#!/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 / 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"');
}
// 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 / 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;
}
@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 / 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 / template.js
Created September 18, 2015 20:31
simple JavaScript template implementation, when we don't want import handlebar
// support if, liquid style filter
var orderInfoTemplate = '\
<div class="section">\
<h2>Order Status</h2>\
<div class="order-number">Order Number: <strong>{order_number}</strong></div>\
<div class="order-status">Status: <strong>{fulfillments[0].status}</strong></div>\
<div class="tracking-number">Tracking Number: {#if fulfillments[0].tracking_number}<strong><a href="{fulfillments[0].tracking_url}">{fulfillments[0].tracking_number}</a></strong> by {fulfillments[0].tracking_company}{/if}</div>\
</div>\
<div class="section">\