Skip to content

Instantly share code, notes, and snippets.

@leesei
leesei / test.md
Last active December 28, 2015 21:19
test case for MarkdownEditing
// @262
// binder: surface->asBinder()/surfaceTexture->asBinder()
// window: surface/SurfaceTextureClient(surfaceTexture)
status_t CameraClient::setPreviewWindow(const sp<IBinder>& binder,
        sp<ANativeWindow> window)

This should be plain text.
But when this code is highlighted with Markdown GFM, the code block bleeds out.

@leesei
leesei / json2csv.js
Created December 16, 2013 06:01
#js #ya-csv #json2csv Convert JSON to CSV
#!/usr/bin/env node
var csv = require('ya-csv');
var path = require('path');
// load the json file
var json = require(path.resolve(process.argv[2]));
console.log(json);
console.log('');
@leesei
leesei / view-yuv.py
Created December 16, 2013 06:35
#python #view-yuv Load YUV file and render it using Pygame
#!/usr/bin/env python
import argparse
import os
import pygame
from pygame.locals import *
import sys
# constants
supported_formats = ('yv12', 'iyuv', 'i420', 'nv12', 'nv21')
@leesei
leesei / google-bookmark-to-json.js
Created December 18, 2013 03:50
#js #snippet google-bookmark-to-json
// first, visit google bookmark and jQuerify it
// convert bookmarks in the current page to json
// (paste to Chrome Dev Tools's Source -> Snippets, "Ctrl+Enter" to run)
function entry2Json(entry) {
return {
title: entry.innerText,
href: entry.href
};
}
@leesei
leesei / jb-apps.md
Last active January 1, 2016 20:38
#ipad #cydia #jailbreak
App Link/Description
AdBlocker crack
AppSync for iOS7
AppCake AppCake HD depends on AppSync for iOS 5
BrowserChooser
Buka for iOS http://ios.ibuka.cn/
CyDelete7
iAPFree 4.0.1+ for iOS5
iAPFree Plugin Pack
@leesei
leesei / evil_ctor.cpp
Created May 13, 2014 09:02
#c #evil-c-tor #c-tor
// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
// An older, deprecated, politically incorrect name for the above.
// NOTE: The usage of this macro was baned from our code base, but some
// third_party libraries are yet using it.
// TODO(tfarina): Figure out how to fix the usage of this macro in the
@leesei
leesei / colors.source
Created November 28, 2014 09:05
#bash #color-source Color macro for BASH
# prompt color and format variables
# A color init string consists of one or more of the following numeric codes:
# * Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# * Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# * Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
# * Extended color codes for terminals that support more than 16 colors:
@leesei
leesei / countAngularBindings.js
Created January 5, 2015 07:20
#snippets #js #angularjs
function getScopes(root) {
var scopes = [];
function traverse(scope) {
scopes.push(scope);
if (scope.$$nextSibling)
traverse(scope.$$nextSibling);
if (scope.$$childHead)
traverse(scope.$$childHead);
}
traverse(root);
@leesei
leesei / Google.desktop
Created July 19, 2015 06:42
Internet shortcuts
[Desktop Entry]
Encoding=UTF-8
Name=Link to Google
Type=Link
URL=https://www.google.com.hk/#q=google
Icon=text-html
@leesei
leesei / cLogger.js
Created August 20, 2015 16:14
Logger to Browser console (with colors)
// http://charlesbking.com/power_of_es6/#/21
//create a logger facade
class Logger {
//constructor
constructor (type = "Info") {
this.type = type;
}
//static methods
static create(type) {