Skip to content

Instantly share code, notes, and snippets.

@ambar
ambar / about.md
Created August 12, 2011 09:51 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@ambar
ambar / teleport.html
Created August 23, 2011 07:21
teleport 无限卷动的内容
<html>
<head>
<title></title>
<style type="text/css">
#list{width:500px;height:auto;background-color: #eee;}
.ph{width:500px;height:600px;background-color: #cde;margin:2em 0;}
</style>
</head>
<body>
<div style="height:100px;background:#cde;">placeholder1</div>
@ambar
ambar / jQuery.data.compatibility.html
Created August 25, 2011 08:42
jQuery data compatibility
<html>
<head>
<title></title>
</head>
<body>
<div data-ID="3" data-blogId="4" data-comment-id="4" data-cat_id="5"></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script>
@ambar
ambar / benchmark.js
Created September 22, 2011 08:31
detect size of call stack
/*
var iter = 100 * 100;
bm('instanceof',iter,function() {
f instanceof Function
})
bm('typeof',iter,function() {
typeof f === 'function'
})
*/
@ambar
ambar / dabblet.css
Created January 5, 2012 13:40
❤ dabblet.com CSS3 playground!
/**
* ❤ dabblet.com CSS3 playground!
*/
html{
font-family: Monaco;
transform: scale(2,.5) rotate(30deg);
background-color: silver;
background-size: 58px 58px;
background-position: 0px 2px, 4px 35px, 29px 31px, 34px 6px;
@ambar
ambar / calc.md
Created January 9, 2012 07:24
sticky element
marginLeft = - ( $container.width() / 2 - parseInt($g.css('right')) - $g.innerWidth() ) = -(450 + 200 - 156)
@ambar
ambar / _.js
Created January 10, 2012 04:04
图片墙和 Bin Packing
var BinPacker = require('./binpacker')
var blocks = []
blocks.push(
// 宽的
{w: 300,h: 390},
{w: 300,h: 390},
// 窄的
{w: 150,h: 195},
@ambar
ambar / app.js
Created January 12, 2012 16:01
大爱 Bender. x-futurama middleware for expressjs app
var express = require('express')
var app = express.createServer()
var port = 3000
app.use( require('./x-futurama') )
app.get('*',function(req,res,next) {
res.end()
})
@ambar
ambar / _demo.html
Created January 18, 2012 04:33
unclosed tag and selectors
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>unclosed tag and selectors</title>
<style type="text/css">
body>div{margin:2em;border:3px dashed gray;height:3em;}
</style>
@ambar
ambar / convert.ps1
Created January 18, 2012 15:37
powershell convert file encoding
# mkdir
md output
# get-content , set-content -encoding
# 括号是必须的
ls *.txt | %{ gc $_ | sc -en utf8 ('output/'+$_.name) }