We have moved: https://github.com/magnetikonline/linuxmicrosoftievirtualmachines
Due to the popularity of this Gist, and the work in keeping it updated via a Gist, all future updates will take place at the above location. Thanks!
var http = require("http"), | |
url = require("url"), | |
path = require("path"), | |
fs = require("fs") | |
port = process.argv[2] || 8888; | |
http.createServer(function(request, response) { | |
var uri = url.parse(request.url).pathname | |
, filename = path.join(process.cwd(), uri); |
#!/usr/bin/python | |
# demo from here: http://pymotw.com/2/urllib2/index.html#uploading-files | |
import itertools | |
import mimetools | |
import mimetypes | |
from cStringIO import StringIO | |
import urllib | |
import urllib2 |
We have moved: https://github.com/magnetikonline/linuxmicrosoftievirtualmachines
Due to the popularity of this Gist, and the work in keeping it updated via a Gist, all future updates will take place at the above location. Thanks!
var hrtime = (function(){ | |
if (typeof window !== 'undefined'){ | |
// browser | |
if (typeof window.performance !== 'undefined' && typeof performance.now !== 'undefined'){ | |
// support hrt | |
return function(){ | |
return performance.now(); | |
}; | |
}else{ | |
// oh no.. |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
// ==UserScript== | |
// @name 百度网盘aria2导出工具 | |
// @author acgotaku311 | |
// @description 一个方便吧百度网盘的Aria2rpc导出的脚本。 | |
// @encoding utf-8 | |
// @include http://*n.baidu.com/s/* | |
// @include http://*n.baidu.com/disk/home* | |
// @include http://*n.baidu.com/share/link* | |
// @include https://*n.baidu.com/s/* | |
// @include https://*n.baidu.com/disk/home* |
dir="." #Set the default temp dir | |
tmpA1="$dir/spectrumhist_1_$$.png" | |
tmpB1="$dir/spectrumhist_1_$$.cache" | |
trap "rm -f $tmpA1 $tmpB1; exit 0" 0 #remove temp files | |
trap "rm -f $tmpA1 $tmpB1; exit 1" 1 2 3 15 #remove temp files | |
if [ $# -eq 2 ] | |
then | |
colors=$2 | |
else | |
colors=8 |
Get the current Unix timestamp (seconds from 1970-01-01T00:00:00Z) in SQL.
UNIX_TIMESTAMP()
CAST(EXTRACT(epoch FROM NOW()) AS INT)
DATEDIFF(s, '1970-01-01', GETUTCDATE())
(CAST(SYS_EXTRACT_UTC(SYSTIMESTAMP) AS DATE) - DATE'1970-01-01') * 86400
--- Actions --- | |
$Copy <M-C> | |
$Cut <M-X> <S-Del> | |
$Delete <Del> <BS> <M-BS> | |
$LRU | |
$Paste <M-V> | |
$Redo <M-S-Z> <A-S-BS> | |
$SearchWeb <A-S-G> | |
$SelectAll <M-A> | |
$Undo <M-Z> |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent