- C-a == Ctrl-a
- M-a == Alt-a
:q close
:w write/saves
:wa[!] write/save all windows [force]
:wq write/save and close
urlencode() { | |
# urlencode <string> | |
old_lc_collate=$LC_COLLATE | |
LC_COLLATE=C | |
local length="${#1}" | |
for (( i = 0; i < length; i++ )); do | |
local c="${1:$i:1}" | |
case $c in |
From: Chris DeSalvo <chris.desalvo@voxer.com> | |
Subject: Why we can't process Emoji anymore | |
Date: Thu, 12 Jan 2012 18:49:20 -0800 | |
Message-Id: <AE459007-DF2E-4E41-B7A4-FA5C2A83025F@voxer.com> | |
--Apple-Mail=_6DEAA046-886A-4A03-8508-6FD077D18F8B | |
Content-Transfer-Encoding: quoted-printable | |
Content-Type: text/plain; | |
charset=utf-8 |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
console.reset = function () { | |
return process.stdout.write('\033c'); | |
} |
#!/bin/sh | |
mkdir -p ~/.vim/syntax/ | |
cd ~/.vim/syntax/ | |
wget http://www.vim.org/scripts/download_script.php?src_id=19394 | |
mv download_script.php\?src_id\=19394 nginx.vim | |
cat > ~/.vim/filetype.vim <<EOF | |
au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/conf/* if &ft == '' | setfiletype nginx | endif | |
EOF |
public void copyFileOrDir(String path) { | |
AssetManager assetManager = this.getAssets(); | |
String assets[] = null; | |
try { | |
assets = assetManager.list(path); | |
if (assets.length == 0) { | |
copyFile(path); | |
} else { | |
String fullPath = "/data/data/" + this.getPackageName() + "/" + path; | |
File dir = new File(fullPath); |
To enable window.gc() on Chrome browser console you just need to start Chrome like this: | |
> /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --js-flags="--expose-gc" --enable-memory-info | |
Those flags enable the following console API, very usefull to debug memory leaks: | |
> console.memory // print memory information | |
> window.gc() // force garbage collection |
def toCamelCase(String string) { | |
String result = "" | |
string.findAll("[^\\W]+") { String word -> | |
result += word.capitalize() | |
} | |
return result | |
} | |
afterEvaluate { project -> | |
Configuration runtimeConfiguration = project.configurations.getByName('compile') |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>IndexedDB onbeforeunload Test</title> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/idbwrapper/1.4.1/idbstore.min.js"></script> | |
<script> | |
var idb, i; | |
var testData1 = []; | |
var testData2 = []; | |
var testData3 = []; |