Skip to content

Instantly share code, notes, and snippets.

View piroor's full-sized avatar

YUKI "Piro" Hiroshi piroor

View GitHub Profile
@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);
@piroor
piroor / urn-link.md
Last active May 12, 2016 04:52
URN link test
@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 / get-ie-path.go
Last active August 1, 2017 09:25
Golang study
package main
import (
"fmt"
"golang.org/x/sys/windows/registry"
)
func main() {
fmt.Printf(GetIEPath())
}
@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 / autoconfig.cfg
Created September 26, 2018 09:34
Register security exception automatically on the startup of Firefox ESR60
// the first line is always ignored by Firefox.
const autoAcceptExceptionFor = (host, port = 443) => {
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
const exceptionURL = port == 443 ? `https://${host}` : `https://${host}:${port}`;
const { Services } = Cu.import('resource://gre/modules/Services.jsm', {});
const observer = {
observe(aSubject, aTopic, aData) {
switch (aTopic) {
@piroor
piroor / autoconfig.cfg
Created September 27, 2018 05:02
Register security exception automatically when a cert error page is initially shown, on Firefox ESR60
// the first line is always ignored by Firefox.
const autoAcceptExceptionFor = (host, port = 443) => {
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
const exceptionURL = port == 443 ? `https://${host}` : `https://${host}:${port}`;
const { Services } = Cu.import('resource://gre/modules/Services.jsm', {});
const observer = {
observe(aSubject, aTopic, aData) {
switch (aTopic) {
@piroor
piroor / peco-commands.sh
Last active November 8, 2018 01:02
Predefined commands based on peco (on Bash)
# Usage:
# 1. Download latest binary of peco from: https://github.com/peco/peco/releases
# 2. Extract "peco" from the downloaded archive and put it to somewhere listed in $PATH.
# 3. Put this file as "~/peco-commands.sh".
# 4. Add a line "source ~/peco-commands.sh".
# 5. Exit and login again.
# from http://bio-eco-evo.hatenablog.com/entry/2017/04/30/044703
peco-cd() {
local sw="1"
@piroor
piroor / prepare.js
Last active December 1, 2018 05:21
Preparation script for running of tests at https://hg.mozilla.org/mozilla-central/rev/cd420001c8ea#l5.145
/*
Usage:
1. Install something addon with "tabs" permission.
2. Go to "about:debugging" and open a debugger for the addon.
3. Go to the console.
4. Run.
*/
(async (global) => {
const windowId = (await browser.windows.create({})).id;