Skip to content

Instantly share code, notes, and snippets.

View wanghailei's full-sized avatar

WANG Hailei wanghailei

View GitHub Profile
@wanghailei
wanghailei / netrw quick reference.md
Created June 17, 2017 17:52 — forked from t-mart/netrw quick reference.md
A quick reference for Vim's built-in netrw file selector.
Map Action
<F1> Causes Netrw to issue help
<cr> Netrw will enter the directory or read the file
<del> Netrw will attempt to remove the file/directory
- Makes Netrw go up one directory
a Toggles between normal display, hiding (suppress display of files matching g:netrw_list_hide) showing (display only files which match g:netrw_list_hide)
c Make browsing directory the current directory
C Setting the editing window
d Make a directory
@wanghailei
wanghailei / wechat-article-horizontal-slide
Created January 7, 2016 16:38
The magic code for a group of image to slide horizontally. It's weird but works due to the <p><br/></p> at the end.
<section style="margin:0 auto;padding:0;border-style:none;">
<p style="white-space:nowrap; overflow-x:scroll;">
<img style="width: 300px !important; margin-right: 5px; visibility: visible !important; height: auto !important;" data-ratio="0.6533333333333333" data-w="300" width="300px" src="https://mmbiz.qlogo.cn/mmbiz/t96EiaazTTSicqr1DQGsPNoL3cbmK3oIe4lM4s4KHbAObYE6bQrdL15uk3TT01XecRUfSO4TS6oEzyfYa0TRzH2Q/0?wx_fmt=png"/>
<img style="width: 300px !important; margin-right: 5px; visibility: visible !important; height: auto !important;" data-ratio="0.6533333333333333" data-w="300" width="300px" src="https://mmbiz.qlogo.cn/mmbiz/t96EiaazTTSicqr1DQGsPNoL3cbmK3oIe4wOFiaG6emYZFhqlXvBCRia7GSPaTChjdWTAPdh1JykzxtlvZ14vmuVYg/0?wx_fmt=png"/>
<img style="width: 300px !important; margin-right: 5px; visibility: visible !important; height: auto !important;" data-ratio="0.6533333333333333" data-w="300" width="300px" src="https://mmbiz.qlogo.cn/mmbiz/t96EiaazTTSicqr1DQGsPNoL3cbmK3oIe4IOkBVV33nkJwPqmGOkOicFEl0l
@wanghailei
wanghailei / bbideolabs.py
Created June 6, 2014 03:51
Code snippets of BB IDEO LABS
# The following code and the code generated art works are the intellectrual properities of Hailei Wang.
# © 2010 - 2014, Hailei Wang. All rights reserved.
colors = ximport( "colors" )
font( "Courier", 200 )
align( CENTER )
text_path_line_1 = textpath( "IDEO", 0, 200, width = WIDTH)
text_path_line_2 = textpath( "LABS", 0, 350, width = WIDTH)
@wanghailei
wanghailei / csallseeingeye.py
Last active February 17, 2024 21:27
Code snippets of All Seeing Eye
# The following code and the code generated art works are the intellectrual properities of Hailei Wang.
# © 2009 - 2014, Hailei Wang. All rights reserved.
from nodebox import geo
colors = ximport("colors")
# Define Brush
def composeimage( x, y, colr, radius, points, diminish ) :
nofill()
stroke()
@wanghailei
wanghailei / cstsunami.py
Last active June 16, 2022 04:58
Code snippets of Tsunami
# The following code and the code generated art works are the intellectrual properities of Hailei Wang.
# © 2010 - 2014, Hailei Wang. All rights reserved.
cornu = ximport("cornu")
colors = ximport("colors")
# Painting waves
palette_for_wave = [ colors.hex( “#020034”, “dark blue” ), colors.hex( “#0A5CD6”, “aqua blue” ), colors.hex( “#FEFFFF”, “milk white” ) ]
# Draw Wave
@wanghailei
wanghailei / List fonts on iOS
Created March 27, 2014 22:37
To list all the installed fonts on iOS, for verifying your customized fonts are installed.
// List the fonts name on the workstation to find out the real customized name.
for ( NSString * fontFamily in [ UIFont familyNames ] ) {
NSLog( @"%@", fontFamily );
for ( NSString * fontName in [UIFont fontNamesForFamilyName: fontFamily ] ) {
NSLog( @" %@", fontName );
}
}
goog.provide('app');
goog.require('goog.dom');
goog.require('goog.style');
goog.require('goog.array');
app.plateSections = function() {
var plateWidth = 0;
// Add the first section's width.
@wanghailei
wanghailei / Generate a SSH
Created January 19, 2013 15:23
Generate a SSH on OS X.
ssh-keygen -t rsa -C "your_email@youremail.com"
# Creates a new ssh key using the provided email
pbcopy < ~/.ssh/id_rsa.pub
@wanghailei
wanghailei / Clean duplicated Context Menu items on OS X
Created January 19, 2013 04:07
Cleaning up duplicate or old entries in the ‘Open With…” context menu on OS X.
Run Terminal, and execute this command.
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/ LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user
Then, relaunch Finder. All done. This has been tested on MacBook Pro (Mountain Lion).
@wanghailei
wanghailei / .vimrc
Created December 26, 2012 23:52
My .vimrc config named Whale
" Whale
" Having Vim in nocompatible mode, opens a lot of features
:set nocompatible
" Encoding
set fileencodings=utf-8
" Use Unix as the standard file type
:set ffs=unix,mac