Skip to content

Instantly share code, notes, and snippets.

@mooz
mooz / js-ctypes-pragma-pack.js
Created November 6, 2012 07:37
#pragma pack for js-ctypes
/* http://en.wikipedia.org/wiki/Data_structure_alignment#Typical_alignment_of_C_structs_on_x86 */
function createStructWithPaddings(name, members, alignmentLimit) {
var membersWithPaddings = [];
var currentOffset = 0;
var maximumAlignment = 0;
if (typeof alignmentLimit === "undefined")
alignmentLimit = Infinity;
var insertedCount = 0;
@mooz
mooz / shibuya-el-position-paper.md
Created August 20, 2012 04:35 — forked from ainame/shibuya-el-position-paper.md
shibuya.elのポジションペーパーです。githubアカウントをお持ちの方はforkしてお使いください。
@mooz
mooz / lemon-mode.el
Created June 21, 2012 10:05
Major mode for editing lemon grammar files
;;; lemon-mode.el --- Major mode for editing lemon grammar files
;; Copyright (C) 2012 mooz
;; Author: mooz <stillpedant@gmail.com>
;; Keywords: lemon
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
@mooz
mooz / _waf
Created June 10, 2012 17:03
completion function for waf
#compdef waf
local context state line
typeset -A opt_args
local -a \
arguments_default \
arguments_configure \
arguments_build_install \
arguments_step \
var EXPORTED_SYMBOLS = ["Logger"];
var { classes: Cc, interfaces: Ci } = Components;
function Logger(logFileName) {
this.logFile = this.openFile(logFileName);
}
Logger.prototype = {
encoding: "UTF-8",
@mooz
mooz / anything-directory-tree.el
Created April 1, 2012 06:11
anything-directory-tree.el
(global-set-key (kbd "C-x C-r") 'anything-directory-tree)
(defun anything-directory-tree ()
(interactive)
(anything 'anything-c-source-directory-tree))
(defvar anything-c-source-directory-tree
'((name . "Directory Tree")
(init . (lambda ()
(shell-command "tree -L 2 -f"
@mooz
mooz / flymake-highlight-mode-line.el
Created January 30, 2012 15:59
Flymake Highlight Mode Line
;; ============================================================ ;;
;; Flymake Highlight Mode Line {{{
;; ============================================================ ;;
(defvar flypaint:error-face
'(:foreground "white" :background "red"))
(defvar flypaint:warning-face
'(:foreground "white" :background "orange red"))
@mooz
mooz / weakmap-ja.txt
Created January 27, 2012 11:57
weakmap-ja.txt
4 つの API メソッドを共有する 2 つの配列( 1 つはキー用、もう 1 つはバリュー用)を => 2 つの配列( 1 つはキー用、もう 1 つはバリュー用)を
# 共有「する」のではなく 4 つの API により共有「される」のだと思い
# ます.それぞれの API は内部で 2 つの配列にアクセスするよ,という
# ことですね.
従って、それらのキーは => キーとなったオブジェクトは
マニュアルでマップを記述した場合 => (2 つの配列を使って)マップを
自作する場合,
@mooz
mooz / gecko-console-logger.js
Created January 25, 2012 15:10
Gecko Console Logger
// "Foo".red.log();
Object.defineProperty(String.prototype, "log", {
value: function () {
dump(this + "\n");
}
});
let (colerCodePairs = {
black : 30,
@mooz
mooz / site-local-keymap-settings.ks.js
Created January 16, 2012 08:46
site-local-keymap-settings.ks.js
// Insert codes below into PRESERVE area of your .keysnail.js file.
(function () {
var local = {};
plugins.options["site_locak_keymap.local_keymap"] = local;
function fake(k, i, type) function () { key.feed(k, i, type); };
function pass(k, i, type) [k, fake(k, i, type)];
function ignore(k) [k, null];