Skip to content

Instantly share code, notes, and snippets.

@valueof
valueof / gist:3744450
Created September 18, 2012 17:25
0++

SpiderMonkey:

> 0++;
SyntaxError: invalid increment operand

V8:

@kejun
kejun / dabblet.css
Last active January 4, 2018 09:43
sample-1缺点 + 必须固定高度
body {
width: 600px;
font:normal 14px/1.62 arial, sans-serif;
}
.mod {
margin-bottom:100px;
background-color:#efc;
}
.pic {
margin-right: 20px;
@paulrouget
paulrouget / functions.html
Last active August 3, 2017 16:44
Defining JavaScript functions, the ES6 way
<!DOCTYPE html>
<meta charset=utf-8 />
<title>Defining JavaScript functions, the ES6 way</title>
<h1>Defining JavaScript functions, the ES6 way</h1>
<em>Use Firefox 22 (Firefox Nightly)</em>
<script>
@basecode
basecode / css-animation-off-ui-thread.html
Last active December 15, 2015 17:49
CSS animations off the UI thread
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width">
<title>CSS animations</title>
<style>
.spin {
-webkit-animation: 3s rotate linear infinite;
animation: 3s rotate linear infinite;
background: red;
@cou929
cou929 / detect-private-browsing.js
Last active May 1, 2024 21:07
Detect private browsing mode (InPrivate Browsing or Incognito).
function retry(isDone, next) {
var current_trial = 0, max_retry = 50, interval = 10, is_timeout = false;
var id = window.setInterval(
function() {
if (isDone()) {
window.clearInterval(id);
next(is_timeout);
}
if (current_trial++ > max_retry) {
window.clearInterval(id);
@yisibl
yisibl / HTML-tags.md
Last active September 15, 2024 14:09
常用的 HTML 头部标签

常用的 HTML 头部标签

详细介绍参见原文:yisibl/blog#1

<!DOCTYPE html> <!-- 使用 HTML5 doctype,不区分大小写 -->
<html lang="zh-cmn-Hans"> <!-- 更加标准的 lang 属性写法 http://zhi.hu/XyIa -->
<head>
    <meta charset='utf-8'> <!-- 声明文档使用的字符编码 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <!-- 优先使用 IE 最新版本和 Chrome -->
/*!
* jQuery JavaScript Library v2.1.1pre
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
@kristopherjohnson
kristopherjohnson / volumeSnippets.applescript
Created March 17, 2014 03:41
Snippets for setting system sound volume via AppleScript
-- See http://apple.stackexchange.com/questions/19146/is-fine-volume-adjustment-possible-in-os-x-lion
set volume output volume 0 --mute
set volume output volume 100 --100%
set volume output volume 27 --27%
@staltz
staltz / introrx.md
Last active August 20, 2026 22:34
The introduction to Reactive Programming you've been missing
#!/bin/bash
# --- Version history ---
# mrn: sleep for $freq instead of 3 seconds (forked)
# 0.4: added variable to store file path, and $2 for base file name
# added variable to store desired reporting interval
# 0.3: added $1 to send in process ID at run time.
# 0.2: switched to $SECONDS for the loop. works.
# 0.1: didn't work well at all.
# --- Version history ---