Skip to content

Instantly share code, notes, and snippets.

View bitinn's full-sized avatar
🔜
Personal Project

David Frank bitinn

🔜
Personal Project
View GitHub Profile
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>margin collapse algorithm bug workaround</title>
<style>
body{
margin:0;
}
.example {
@bitinn
bitinn / gist:7744788
Created December 2, 2013 03:55
VAGRANT_LOG=debug vagrant up
....
GuestMemoryBalloon=0
GuestOSType="Linux26_64"
GuestAdditionsRunLevel=2
GuestAdditionsVersion="4.3.2 r90405"
GuestAdditionsFacility_VirtualBox Base Driver=50,1385956089494
GuestAdditionsFacility_VirtualBox System Service=50,1385956120744
GuestAdditionsFacility_Seamless Mode=0,1385956089494
GuestAdditionsFacility_Graphics Mode=0,1385956089494
@bitinn
bitinn / README.md
Last active September 21, 2023 20:36
A soft-fullscreen prompt for iOS7+

A soft-fullscreen prompt for iOS7+

Background

iOS 7.0 and iOS 8 (Beta) do not have support for minimal-ui viewport keyword, nor do they response to window.slideTo(0,1) or support Fullscreen API, which means there is no easy way to tell Mobile Safari to hide address bar/menu without user interaction.

This is a problem for Web App that mimics Native App design, where html/body are commonly set to height: 100%, so browser viewport = available screen estate. There are currently no solution besides adding apple-mobile-web-app-capable meta and ask users to manually Save to Homescreen.

Frustrated by this limit, we present a soft-fullscreen prompt design, which, coupled with proper CSS hack, can achieve soft-fullscreen with relatively small effort from users.

@bitinn
bitinn / dns-hijack-china
Created January 11, 2015 13:39
Random DNS response hijack in China
df-air:kneesocks df$ curl -x http://127.0.0.1:8002 --verbose --insecure https://twitter.com/
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8002 (#0)
* Establish HTTP proxy tunnel to twitter.com:443
> CONNECT twitter.com:443 HTTP/1.1
> Host: twitter.com:443
> User-Agent: curl/7.37.1
> Proxy-Connection: Keep-Alive
>
@bitinn
bitinn / namebench-2014-01-13.csv
Last active August 29, 2015 14:13
深圳电信 namebench 2014-01-13
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 9 columns, instead of 10 in line 1.
IP,Name,Test_Num,Record,Record_Type,Duration,TTL,Answer_Count,Response
61.135.159.46,Tom CN,0,backbonetutorials.com.,A,442.88611412,300,1,"104.28.23.110, 104.28.22.110",
61.135.159.46,Tom CN,0,help.github.com.,A,324.376106262,30,2,github.map.fastly.net. -> 103.245.222.133,
61.135.159.46,Tom CN,0,www.geekwire.com.,A,937.829971313,300,2,geekwire.com. -> 104.130.53.67,
61.135.159.46,Tom CN,0,www.dwuser.com.,A,489.170074463,3600,1,108.61.83.130,
61.135.159.46,Tom CN,0,css-tricks.com.,A,356.249094009,300,1,"199.83.128.152, 199.83.132.152",
61.135.159.46,Tom CN,0,lifesinger.github.io.,A,200.210094452,3600,2,github.map.fastly.net. -> 103.245.222.133,
61.135.159.46,Tom CN,0,ja.wikipedia.org.,A,414.385795593,600,1,208.80.154.224,
61.135.159.46,Tom CN,0,www.google.com.,A,72.8459358215,84,1,"173.194.127.49, 173.194.127.51, 173.194.127.50, 173.194.127.52, 173.194.127.48",
61.135.159.46,Tom CN,0,www.beatsbydre.com.,A,678.999185562,300,3,wildcard.beatsbydre.com.edgekey.net. -> e7716.b.akamaiedge.net. -> 23.42.181.121,
@bitinn
bitinn / README.md
Created January 13, 2015 16:31
深圳电信,DNS测速,namebench 2015-01-14

https://code.google.com/p/namebench/

基于我自身浏览习惯+深圳电信线路的namebench测试,整合了以下公共DNS列表的测试结果:

个人结论是:无论使用国内还是国外的DNS,都在解析网站时受到相当的干扰,如果不是劫持和黑洞,就是纯粹的丢包超时。只有在用户端设好工具,所有海外DNS请求走加密通道,才可以杜绝触发黑洞和过滤。在用户端想办法过滤虚假的DNS结果也可行,但并不能真正解决超时的使用问题。

@bitinn
bitinn / test.js
Created January 21, 2015 13:05
promise-vs-thunk-in-fast-loop
var co = require('co');
//var Promise = require('bluebird');
//var Promise = require('promise');
var count = 0;
co(function* () {
while (true) {
count++;
try {
yield getData();
@bitinn
bitinn / gist:600af3e5a80ebab62dc6
Last active August 29, 2015 14:21
PingHei-light.woff character map

Keybase proof

I hereby claim:

  • I am bitinn on github.
  • I am bitinn (https://keybase.io/bitinn) on keybase.
  • I have a public key whose fingerprint is BD1F EBEC 967D 3CA6 F7A6 90F8 ED26 32B2 A99F A46A

To claim this, I am signing this object:

@bitinn
bitinn / abstraction-for-deku.js
Last active August 29, 2015 14:22
vdom-compat (make virtual-dom hyperscript template work with deku)
/**
* vdom.js
*
* A virtual-dom compatibility layer
*/
var element = require('deku').element;
var classIdMatch = /([\.#]?[a-zA-Z0-9_:-]+)/;
var nonEmpty = function(input) {
return input !== '';