Skip to content

Instantly share code, notes, and snippets.

@hax
hax / intl-typehint-bug.php
Last active August 29, 2015 13:57
typehint bug of Intl extension in PHP 5.5
<?php
$f = new ReflectionFunction('intltz_from_date_time_zone');
var_dump($f->getParameters()[0]->getClass()); // cause ReflectionException in PHP 5.5
/*
run `php --rf intltz_from_date_time_zone` =>
Function [ <internal:intl> function intltz_from_date_time_zone ] {
- Parameters [1] {
@hax
hax / gist:3982309
Created October 30, 2012 19:07
modulelint 0.0.2 bug
D:\working\hax\mmclass [master]> modulelint -i .
C:\Users\Administrator\AppData\Roaming\npm\node_modules\modulelint\lib\checklist
\bom.js:22
var blackListReg = new RegExp(blackList.join("|"));
^
SyntaxError: Invalid regular expression: /\doc\|\.git\|\.svn\|\node_modules\/: \
at end of pattern
at new RegExp (unknown source)
at Object.<anonymous> (C:\Users\Administrator\AppData\Roaming\npm\node_modul
@hax
hax / gist:3482308
Created August 26, 2012 18:22
How to create a naked Object in old Browsers (eg. IE 6,7,8) which not support Object.create(null) or {__proto__: null}
function nakedObject() {
var iframe = document.createElement('iframe')
iframe.width = iframe.height = 0
iframe.style.display = 'none'
document.appendChild(iframe)
iframe.src = 'javascript:'
var proto = iframe.contentWindow.Object.prototype
iframe.parentNode.removeChild(iframe)
iframe = null
@hax
hax / show_more_groups_for_my_weibo
Created September 20, 2011 10:07
A bookmarklet to show more group links for the Sina Weibo v4 (Sep, 2011)
javascript:void function(){STK.sizzle('[node-type="feedGroupLayer"]')[0].style.display='block';STK.sizzle('[node-type="feedGroupLayer"] a[href]')[0].focus()}()