Skip to content

Instantly share code, notes, and snippets.

View dingyi's full-sized avatar
🏠
Working from home

Ding Yi dingyi

🏠
Working from home
View GitHub Profile
/* `XHTML, HTML4, HTML5 Reset
----------------------------------------------------------------------------------------------------*/
a,
abbr,
acronym,
address,
applet,
article,
aside,
@dingyi
dingyi / autoproxy.js
Created November 5, 2011 05:10 — forked from sofish/autoproxy.js
何必加密
/*
* 何必加密,=,=
* 把 decode64() 这个函数的最后一句,“return _3 改成 console.log(_3)”
* 在任何支持 console.log() 的浏览器运行一下,就看出“真正”的源码。
* 何必加密,真是浪费资源
*/
function decode64(_1) {
var _2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var _3 = "";
@dingyi
dingyi / gist:1584007
Created January 9, 2012 17:27 — forked from joefiorini/gist:1511971
Backbone + Stripe = AWESOME
class Stripe.TokenRequest extends Backbone.Model
validate: (attrs)->
error =
if !attrs.name
attribute: "name"
message: "Please enter your name"
else if !attrs.email
attribute: "email"
message: "Invalid email"
else if !Stripe.validateCardNumber(attrs.number)
@dingyi
dingyi / data-markdown.user.js
Created January 22, 2012 17:25 — forked from paulirish/data-markdown.user.js
*[data-markdown] - use markdown, sometimes, in your HTML
// ==UserScript==
// @name Use Markdown, sometimes, in your HTML.
// @author Paul Irish <http://paulirish.com/>
// @link http://git.io/data-markdown
// @match *
// ==/UserScript==
// If you're not using this as a userscript just delete from this line up. It's cool, homey.
@dingyi
dingyi / _grid-base.sass
Created February 24, 2012 00:37
Fluid Desktop & Mobile Grid
// This file requires Sass & Compass.
//
// - http://sass-lang.com
// - http://compass-style.org
@import compass/css3/box-sizing
// `Clear floated elements.
//----------------------------------------------------------------------------------------------------
@dingyi
dingyi / PSPDFWebViewController.m
Created March 7, 2012 17:48
How to write a pixel perfect backbutton in code. (stuff goes into viewDidLoad). Taken from http://pspdfkit.com
forwardBarButtonItem_ = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPlay target:self action:@selector(goForward:)];
// back button needs more treatment...
UIGraphicsBeginImageContextWithOptions(CGSizeMake(27, 22), NO, 0.0);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColor(context, CGColorGetComponents([UIColor blackColor].CGColor));
CGContextBeginPath(context);
CGContextMoveToPoint(context, 8.0f, 13.0f);
CGContextAddLineToPoint(context, 24.0f, 4.0f);
CGContextAddLineToPoint(context, 24.0f, 22.0f);
@dingyi
dingyi / hack.sh
Created April 1, 2012 04:52 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@dingyi
dingyi / dabblet.css
Created April 22, 2012 14:08 — forked from LeaVerou/dabblet.css
Vertical centering with Flexbox + margin fallback
/**
* Vertical centering with Flexbox + margin fallback
* Lea Verou & David Storey
*/
html, body { height: 100%; }
body {
width: 100%; /* needed for FF */
margin: 0;
@dingyi
dingyi / dabblet.css
Created June 13, 2012 02:28 — forked from kejun/dabblet.css
Untitled
.item {
margin-bottom: 20px;
padding: 10px;
font-size: 0;
border: 1px solid #efefef;
}
.item .pic ,
.item .content {
display: table-cell;
*display: inline;
@dingyi
dingyi / pr.md
Created August 15, 2012 04:14 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: