Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
#
# This shows a MacBook Pro Retina screen model number.
# The modile number will be something like LP154YL01001.
#
# * "LS" prefix: built by Samsung
#
# * "LP" prefix: built by LG
#
# The screens manufactured by LG have had many problems with ghosting and image retention.
@metaphox
metaphox / tree.md
Created January 3, 2013 06:32 — forked from hrldcpr/tree.md

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

'#'+Math.floor(Math.random()*16777215).toString(16);
@metaphox
metaphox / .zshrc
Created February 20, 2013 17:07
zsh theme
# metaphox.zsh-theme
#
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
# primary prompt, 80 col ruler, with double dash at 40
# PROMPT='$FG[237]\
@metaphox
metaphox / rename.sh
Created February 21, 2013 13:09
change committer name
git filter-branch --commit-filter '
if [ "$GIT_COMMITTER_NAME" = "<Old Name>" ];
then
GIT_COMMITTER_NAME="<New Name>";
GIT_AUTHOR_NAME="<New Name>";
GIT_COMMITTER_EMAIL="<New Email>";
GIT_AUTHOR_EMAIL="<New Email>";
git commit-tree "$@";
else
git commit-tree "$@";

To open a remote URL at application startup with phoneGap 2.0 :

after project creation, in XCode expand "CordovaLib.xcodeproj" and open "Classes/Cleaver/CDVViewController.m" then edit the code : replace

NSString* startFilePath = [self pathForResource:self.startPage];

by

NSString* startFilePath = self.startPage;

. Bundle 'gmarik/vundle'
. Bundle 'MarcWeber/vim-addon-mw-utils'
"various utils such as caching interpreted contents of files or advanced glob like things
. Bundle 'tomtom/tlib_vim'
"provides some utility functions
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
styleSheetRaw = null;
fileSystem = null;
imgDataURIs = {};
imgBgStyle = $('#img-bg-style');
bgStyleUrl = imgBgStyle.attr('href');
function useLocalImages(msg){
console.log(msg);
(function(){
var colors = [
"#F0F0F0", "#AAAAAA", "#888888", "#333333",
"#B00B1E", "#003366", "#00BB33", "#00FF00"
];
$('#zh-question-answer-wrap .voters a').each(function(){
var self = $(this);
$.get("http://www.zhihu.com/node/MemberProfileCardV2?params=" +
encodeURIComponent('{"url_token":"' +
self.attr('data-tip').split("$")[2] + '"}'