Skip to content

Instantly share code, notes, and snippets.

View piroor's full-sized avatar

YUKI "Piro" Hiroshi piroor

View GitHub Profile
@piroor
piroor / computed-style.png
Created May 24, 2011 10:26
Screenshots around vertical tab bar
computed-style.png
@piroor
piroor / screenshot-fx6-tst-tabgroupsmanager
Created August 29, 2011 15:25
screen shot: Firefox 6 + Tree Style Tab + TabGroups Manager
With the prefs:
group bar = 0
tab bar = 1
@piroor
piroor / socket.io.js
Last active March 25, 2018 20:29
Wrapper of socket.io-client for Sencha Touch/ExtJS.
/**
* Usage:
* var socket = Ext.create('MyApp.data.SocketIO', {
* host: 'localhost',
* port: 80
* });
*
* License: The MIT License
* Copyright (c) 2013 ClearCode Inc. / YUKI "Piro" Hiroshi
*/
@piroor
piroor / geturi.js
Last active December 15, 2015 03:19
Sample code to research the URI of the blocklist on the platform.
/**
* Original:
* http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/nsBlocklistService.js?raw=1
* Usage:
* 1. Go to "about:config" and turn "devtools.chrome.enabled" to "true".
* 2. Start "Scratchpad" with Shift-F4.
* 3. Change the context from "web page" to "browser".
* 4. Copy this script and paste to the scratchpad.
* 5. Run it.
* Sample result:
@piroor
piroor / Menu.js
Last active January 12, 2017 16:23
Simple dropdown menu component for Sencha Touch 2
/**
* License: The MIT License
* Copyright (c) 2013 ClearCode Inc.
*
* Description:
* Simple dropdown menu component for Sencha Touch 2.
* This works like:
* [Anchor button]
* __/\____
* |Item 1|
@piroor
piroor / one-time.js
Last active December 18, 2015 08:39
Stress test with one-time gradients
var canvas = document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas');
canvas.width = 100;
canvas.height = 100;
canvas.setAttribute('style', 'width:100px;height:100px;position:fixed;top:0;right:0;z-index:10000;');
document.documentElement.appendChild(canvas);
var context = canvas.getContext('2d');
function random(max) {
return parseInt(Math.random() * max);
}
@piroor
piroor / GroongaStringUtils.js
Created July 18, 2013 07:58
GroongaStringUtils, for extraction of matched terms on the client side.
/**
* Usage:
* var matcher = GroongaStringUtils.getTermsMatcher('検索 OR けんさく');
* // => /(a pattern to match all search terms in the given query)/g
* document.body.innerHTML = document.body.innerHTML
* .replace(matcher, function(term) { return '<em>' + term + '</em>'; });
*
* License: The MIT License
* Copyright (c) 2013 ClearCode Inc.
*/
@piroor
piroor / crash-with-crashreport.js
Last active December 31, 2015 14:49
Crash firefox by js-ctypes (run in the scratch pad or the browser console)
(function(){
Components.utils.import('resource://gre/modules/ctypes.jsm');
var library = ctypes.open(ctypes.libraryName('nss3'));
var PR_Free = library.declare(
'PR_Free',
ctypes.default_abi,
ctypes.void_t,
ctypes.voidptr_t
);
var ptr = new ctypes.voidptr_t(0123);
/**
* @fileOverview JSDeferred flavoured Promise.jsm
* @author [email protected]
* @version 0.1
* @license
* JSDeferred flavoured Promise.jsm Copyright (c) 2014 YUKI "Piro" Hiroshi
* JSDeferred Copyright (c) 2007 cho45 ( www.lowreal.net )
*
* Original: http://github.com/cho45/jsdeferred
*