Skip to content

Instantly share code, notes, and snippets.

Avatar

WANG Hailei wanghailei

View GitHub Profile
@wanghailei
wanghailei / netrw quick reference.md
Created Jun 17, 2017 — forked from t-mart/netrw quick reference.md
A quick reference for Vim's built-in netrw file selector.
View netrw quick reference.md
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 Jan 7, 2016
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.
View wechat-article-horizontal-slide
<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 Jun 6, 2014
Code snippets of BB IDEO LABS
View bbideolabs.py
# 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 Apr 30, 2021
Code snippets of All Seeing Eye
View csallseeingeye.py
# 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 Dec 9, 2019
Code snippets of Tsunami
View cstsunami.py
# 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 Mar 27, 2014
To list all the installed fonts on iOS, for verifying your customized fonts are installed.
View List fonts on iOS
// 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 );
}
}
View Implement goog.style.setInlineBlock manually
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 Jan 19, 2013
Generate a SSH on OS X.
View Generate a SSH
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 Jan 19, 2013
Cleaning up duplicate or old entries in the ‘Open With…” context menu on OS X.
View Clean duplicated Context Menu items 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 Dec 26, 2012
My .vimrc config named Whale
View .vimrc
" 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