Skip to content

Instantly share code, notes, and snippets.

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

Shihua Ma mashihua

🏠
Working from home
View GitHub Profile
@mashihua
mashihua / file_input_example.css
Created December 14, 2011 03:42 — forked from nathansmith/file_input_example.css
Markup to Hide a File Input
.fake_file_input {
background: url(../images/fake_file_input.png) no-repeat;
cursor: pointer;
width: 150px;
height: 30px;
overflow: hidden;
position: relative;
display: inline-block;
*display: inline;
*zoom: 1;
@mashihua
mashihua / mysql_to_omnigraffle.applescript
Created December 26, 2011 03:01 — forked from guilhermechapiewski/mysql_to_omnigraffle.applescript
AppleScript to dump MySQL tables to OmniGraffle Pro.
(*
Copyright (c) 2008, Christian Mittendorf <[email protected]>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list ofconditions and the following disclaimer. Redistributions in binary form
must reproduce the above copyright notice, this list of conditions and the
@mashihua
mashihua / nextTick.js
Created January 2, 2012 18:16
GC time for V8
var time = (+new Date) + 1000 * 60;
process.nextTick(function w(){
if(+new Date < time)
process.nextTick(arguments.callee)
});
@mashihua
mashihua / README.md
Created January 6, 2012 13:13
Query tickets in china

Run it your own risk.

Query tickets in china

How to

  1. Copy ticket.js and run it on your browser
  2. Install node.js
  3. Put package.json and server.js into a folder
  4. Copy a mp3 to the same forder and rename it to "alert.mp3"
@mashihua
mashihua / number_hash_collision.php
Created January 9, 2012 03:21
Hash collision in PHP
<?php
$size = pow(2, 16); // 16 is just an example, could also be 15 or 17
$startTime = microtime(true);
$array = array();
for ($key = 0, $maxKey = ($size - 1) * $size; $key <= $maxKey; $key += $size) {
$array[$key] = 0;
}
@mashihua
mashihua / lbyl-test.js
Created February 14, 2012 08:01
LBYL test
//test browser "look-before-you-leap" (LBYL) request
//expect is a header of HTTP/1.1
var http = require('http');
http.createServer(function(req,res){
console.log(req.header['user-agent'],req.header.expect);
});
@mashihua
mashihua / README
Created April 17, 2012 04:09
Patch for v8
#Escape the 1.4GB V8 heap limit patch for Version 3.10.2
Usage: patch -p0 < v8.patch
@mashihua
mashihua / README
Created June 15, 2012 04:26
TextMate 2 的 rmate 用法
打开 Preferences -> Terminal 保证:Accept ramte connectio 选中。
mate ~/.ssh/config
添加下面:
Host *
RemoteForward 52698 127.0.0.1:52698
登录远程的一台 linux 机器。运行下面的命令:
@mashihua
mashihua / README.md
Created June 15, 2012 09:59
Practice BFN
@mashihua
mashihua / post-commit
Created June 19, 2012 07:34
Git commit hook for trello.com
#!/usr/bin/env node
//please requist your app token from
//https://trello.com/1/connect?key=yourkey&name=git-hook&expiration=never&response_type=token&scope=read,write
var key = "your key";
var token = "your token";
//https://trello.com/board/-/4e9003324a517dad44465056
var board_id = "4e9003324a517dad44465056";
var Trello = require("node-trello");