This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# git clone will give you the whole repository. | |
# After the clone, you can list the tags with git tag -l; | |
# then checkout a specific tag: git checkout tags/<tag_name> | |
git clone <repo-address> | |
git tag -l | |
git checkout <tag-name> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- A script to get max call stack size in browser | |
In my Macbook pro | |
Firefox 28: | |
maxStackSize = 350801 (dynamic, but always above 300000) | |
error: InternalError: too much recursion | |
Safari 7.0.2 | |
maxStackSize = 58034 | |
error: RangeError: Maximum call stack size exceeded. | |
Chrome 33: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"encoding/json" | |
) | |
type js struct { | |
A map[string]interface{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// An OpenGL3 Exmaple: glew, glfw and nanovg. | |
// 2D and 3D in same scene. Torus is drawn with static display list. | |
#include <stdlib.h> | |
#include <math.h> | |
#include <stdio.h> | |
#include "GL/glew.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Draw rotating Torus with GLFW3 | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <math.h> | |
#include <GLFW/glfw3.h> | |
static void drawTorus(int numMajor, int numMinor, float majorRadius, float minorRadius) | |
{ | |
static double PI = 3.1415926535897932384626433832795; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// It's tested on ios 8.2 .. | |
// Apple document about virtual memory: | |
// Both OS X and iOS include a fully-integrated virtual memory system that you cannot turn off; it is always on. | |
// https://developer.apple.com/library/mac/documentation/Performance/Conceptual/ManagingMemory/Articles/AboutMemory.html | |
// Discussing mmap on ios: | |
// http://stackoverflow.com/questions/13425558/why-does-mmap-fail-on-ios | |
// http://stackoverflow.com/questions/9184773/is-there-a-practical-limit-on-the-number-of-memory-mapped-files-in-ios | |
#include <sys/mman.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function copyFileSync(srcFile, destFile) { | |
var BUF_LENGTH, buff, bytesRead, fdr, fdw, pos; | |
BUF_LENGTH = 64 * 1024; | |
buff = new Buffer(BUF_LENGTH); | |
fdr = fs.openSync(srcFile, 'r'); | |
fdw = fs.openSync(destFile, 'w'); | |
bytesRead = 1; | |
pos = 0; | |
while (bytesRead > 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// set file add/mode time | |
var fs = require('fs') | |
function setFileTime(filePath, atime, mtime) { | |
fs.utimesSync(filePath, atime, mtime); | |
} | |
var date = new Date('Thu Aug 20 2015 15:10:36 GMT+0800 (CST)'); | |
setFileTime('/tmp/scache/fdf/admin.log', date, date); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fetch all branches | |
# From: http://stackoverflow.com/questions/10312521/how-to-fetch-all-git-branches | |
#!/bin/bash | |
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master`; do | |
git branch --track ${branch##*/} $branch | |
done | |
git fetch --all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
<!-- from https://github.com/airbnb/airpal/blob/master/src/main/resources/assets/index.html > | |
<!-- to avoid being banded by GFW --> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> | |
<script>window.jQuery || document.write('<script src="app/javascripts/vendor/jquery-1.9.0.min.js"><\/script>')</script> | |
</body> |
OlderNewer