This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" add to .vimrc | |
function! Make() | |
if &modified | silent write | endif | |
if &makeprg == 'make' | return | endif | |
silent make | |
execute 'cw' | |
endfunction | |
autocmd Filetype javascript setlocal makeprg=jsl\ -nologo\ -nofilelisting\ -nosummary\ -nocontext\ -conf\ /etc/jsl.conf\ -process\ % | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mint | |
# screenlets | |
# Show bandwidth use oneliner | |
while true; do cat /proc/net/dev; sleep 1; done | awk -v dc="date \"+%T\"" '/eth0/{i = $2 - oi; o = $10 - oo; oi = $2; oo = $10; dc|getline d; close(dc); if (a++) printf "%s %8.2f KiB/s in %8.2f KiB/s out\n", d, i/1024, o/1024}' | |
# limit the cpu usage of a process | |
sudo cpulimit -p pid -l 50 | |
# ubuntu root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://www.cnblogs.com/yaob/archive/2011/05/14/2046013.html | |
public string formatSize(long size) | |
{ | |
if (size == 0) return "0"; | |
string[] sizetext = new string[] { "B", "KB", "MB", "GB", "TB", "PB" }; | |
int i = (int)Math.Floor(Math.Log(size, 1024)); | |
return Math.Round(size / Math.Pow(1024, i), 2).ToString() + " " + sizetext[i]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr=["a","b","c","a","ba","bc"]; | |
alert(arr.join(",").match( /([^,]+)(?!.*,\1(,|$))/ig)); | |
Array.prototype.deleteEle=function(){ | |
var arr=this,o={},newArr=[],i; | |
for( i=0;i<arr.length;i++){ | |
if(typeof(o[arr[i]])==="undefined"){ | |
newArr[newArr.length]=arr[i] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// realpath.c: display the absolute path to a file or directory. | |
// Adam Liss, August, 2007 | |
// This program is provided "as-is" to the public domain, without express or | |
// implied warranty, for any non-profit use, provided this notice is maintained. | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <libgen.h> | |
#include <limits.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<script> | |
chrome.experimental.webRequest.onResponseStarted | |
.addListener(function(details) { | |
console.log(details.url); | |
} | |
, {urls: ["*://*/*.mp3", "*://*/*.mp4", "*://*/*.flv", "*://*/*.webm"]} | |
); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Runtime.InteropServices; | |
[DllImport("kernel32.dll")] | |
static extern uint GetTickCount(); | |
static void Delay(uint ms) { | |
uint start = GetTickCount(); | |
while (GetTickCount() - start < ms) { | |
Application.DoEvents(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>CSSPrimitiveValue & RGBColor</title> | |
</head> | |
<body> | |
<div id="panel1" style="background-color:#09c;"> test</div> | |
</body> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Checkbox Hack */ | |
input[type=checkbox] { | |
position: absolute; | |
top: -9999px; | |
left: -9999px; | |
} | |
label { | |
-webkit-appearance: push-button; | |
-moz-appearance: button; |
OlderNewer