Skip to content

Instantly share code, notes, and snippets.

View yangg's full-sized avatar

Brook yangg

  • ShenZhen, China
View GitHub Profile
@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 08:31
box-shadow, resize - Learning Css3
/**
* box-shadow, resize - Learning Css3
*/
div { width: 100px; height: 100px; border: solid 1px #ccc;
margin: 20px; float: left; }
/* box-shadow: h-shadow v-shadow blur spread color inset; */
.shadow1 { box-shadow: 5px 5px 8px #f06; }
.shadow-inner { box-shadow: 0 0 10px #f06 inset; }
.shadow-oneside { box-shadow: 5px 0 5px -5px #f06; }
@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; }
@yangg
yangg / dabblet.css
Created March 22, 2012 10:29
text-shadow, text-stroke - Learning Css3
/**
* text-shadow, text-stroke - Learning Css3
*/
div { border: solid 1px #ccc; margin: 10px; padding: 0 10px;
font: 2em/1.8 Verdana,Microsoft YaHei,Ubuntu; }
/**
* text-shadow: h-shadow v-shadow blur color;
*/
.text-shadow { text-shadow: 2px 2px #666; font-size: 1.5em; }