Skip to content

Instantly share code, notes, and snippets.

View BodhiHu's full-sized avatar
🌴
bodhicitta

Bodhi BodhiHu

🌴
bodhicitta
  • AMD, SAP
  • Shanghai
View GitHub Profile
@BodhiHu
BodhiHu / gen_filenametags.sh
Created April 26, 2013 04:25
A simple script to generate project files names tags for quick reference of plugin lookupfile.
#!/bin/sh
# generate tag file for lookupfile plugin
echo -e "!_TAG_FILE_SORTED\t2\t/2=foldcase/" > filenametags
find . -not -regex '.*\.\(png\|gif\)' -type f -printf "%f\t%p\t1\n" | \
sort -f >> filenametags
@BodhiHu
BodhiHu / .vimrc
Last active December 17, 2015 08:39
.vimrc for a smooth coding environment
" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
" you can find below. If you wish to change any of those settings, you should
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
" everytime an upgrade of the vim packages is performed. It is recommended to
" make changes after sourcing debian.vim since it alters the value of the
" 'compatible' option.
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
@BodhiHu
BodhiHu / e244.py
Created June 24, 2014 06:52
e244 answer with paths
import re
start = (0, sum([1 << x for x in [1, 4, 5, 8, 9, 12, 13]]))
stop = (0, sum([1 << x for x in [2, 5, 7, 8, 10, 13, 15]]))
def get_next((white, reds)):
all_nexts = []
is_red = lambda x: (reds & (1 << x)) > 0
new_whites = []
if white > 3: new_whites.append((white - 4, 'U'))
if white < 12: new_whites.append((white + 4, 'D'))
@BodhiHu
BodhiHu / (Meteor) Build With Crosswalk for Android.md
Last active December 16, 2017 08:57
(Meteor) Build With Crosswalk for Android

Build With Crosswalk for Android

Build

  • Build meteor:
meteor build .build --server "https://server/url"
  • Download the [crosswalk cordova package][1], rename the framework/ to CordovaLib, and copy it to override meteor build's CordovaLib.
  • Add VERSION file:
cp /VERSION VERSION
@BodhiHu
BodhiHu / Git errors de Mys.md
Created May 9, 2015 08:44
Git errors de Mys

unable to index file

  • errors
error: unable to index file path/to/file
fatal: updating files failed
  • de Mys
git reset path/to/file
@BodhiHu
BodhiHu / Android IQs.md
Last active August 29, 2015 14:21
Android IQs

Android IQs

Intent

  • <intent-filter>: action, category, data
  • Pending intent, NotificationManager

Activity

  • Activity lifecycle
  • Intent flags/launchMode:standard, singleTop, singleTask, singleInstance
  • best practices for Acti.. and Frag..: use Acti.. to manage Frag...
@BodhiHu
BodhiHu / .md
Last active October 4, 2015 09:52
Grunt de Mys
@BodhiHu
BodhiHu / clone.js
Last active January 3, 2016 05:08
Deep clone an JS object: non recursive way. This originally is a fix of the famous.utilities.Utility.clone method (https://github.com/SeanOceanHu/famous/blob/develop/src/utilities/Utility.js#L115), which could easily cause call stack overflow)
/*
* Trampoline to avoid recursion in JS, see:
* http://www.integralist.co.uk/posts/js-recursion.html
*/
function trampoline() {
var func = arguments[0];
var args = [];
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
# add the email package
meteor add email