Skip to content

Instantly share code, notes, and snippets.

View yangg's full-sized avatar

Brook yangg

  • ShenZhen, China
View GitHub Profile
@yangg
yangg / cssprimitievalue.html
Created December 18, 2011 03:28
CSSPrimitiveValue & RGBColor
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8" />
<title>CSSPrimitiveValue & RGBColor</title>
</head>
<body>
<div id="panel1" style="background-color:#09c;"> test</div>
</body>
<script>
@yangg
yangg / dabblet.css
Created December 28, 2011 03:08 — forked from chriscoyier/dabblet.css
Checkbox Hack
/* Checkbox Hack */
input[type=checkbox] {
position: absolute;
top: -9999px;
left: -9999px;
}
label {
-webkit-appearance: push-button;
-moz-appearance: button;
@yangg
yangg / tar.sh
Created January 8, 2012 07:21
tar
# zip
zip -r test.zip .vim .vimrc
unzip -l test.zip
zip -d test.zip filename_to_delete
zip -e test.zip path_to_file
zip -er test.zip path_to_folder
# rar
rar a test.rar .emacs.d .emacs
unrar x test.rar
@yangg
yangg / .py
Created January 31, 2012 01:37
最神奇的除法:1/998001
from decimal import Decimal
print 1/Decimal(998001)
@yangg
yangg / dabblet.css
Created February 9, 2012 03:26 — forked from LeaVerou/dabblet.css
Typing animation with pure CSS
/**
* Typing animation with pure CSS
* Revised. Browser support (as of Feb 2012): Firefox, IE10
*/
@keyframes typing { from { width: 0; } }
@keyframes blink-caret { 50% { border-color: transparent; } }
h1 {
font: bold 200% Consolas, Monaco, monospace;
@yangg
yangg / dabblet.css
Created February 9, 2012 03:27 — forked from LeaVerou/dabblet.css
Move in a circle without wrapper elements
/**
* Move in a circle without wrapper elements
* Idea by Aryeh Gregor, simplified by Lea Verou
*/
@keyframes rot {
from {
transform: rotate(0deg)
translate(-150px)
rotate(0deg);
@yangg
yangg / getimagetype.py
Created February 15, 2012 06:39
Get image type
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def get_image_type(filename):
with open(filename, 'rb') as f:
data = f.read(10).encode('hex')
ftype = None
if data.startswith('ffd8'):
ftype = 'jpeg'
elif data.startswith('474946'):
@yangg
yangg / dabblet.css
Created February 28, 2012 15:21 — forked from LeaVerou/dabblet.css
Flexible multiline definition lists with 2 lines of CSS
/**
* Flexible multiline definition lists with 2 lines of CSS
*/
dt, dd { display: inline; margin: 0; }
dd:after {
content: '\A';
white-space: pre;
}
#include <stdio.h>
#define A(x) x;x;x;x;x;x;x;x;x;x;
int main (void)
{
int n = 1;
A(A(A(printf ("%d ", n++))));
return 0;
}
@yangg
yangg / dabblet.css
Created March 22, 2012 06:00
Checkable star
/**
* Checkable star
*/
.checkable-star { display: none; }
.checkable-star + label { padding: 1px 8px; cursor: pointer; background: url(http://uedsky.com/images/res/star-icons.png) no-repeat; }
.checkable-star + label:hover { background-position: -16px 0; }
.checkable-star:checked + label { background-position: -32px 0; }