Skip to content

Instantly share code, notes, and snippets.

View u27a4's full-sized avatar

u27a4

View GitHub Profile
@u27a4
u27a4 / Euphonium.tmTheme
Last active September 25, 2016 11:46
A simple sublime color scheme based on Atom Chester
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- Generated by: TmTheme-Editor -->
<!-- ============================================ -->
<!-- app: http://tmtheme-editor.herokuapp.com -->
<!-- code: https://github.com/aziz/tmTheme-Editor -->
<plist version="1.0">
<dict>
<key>name</key>
<string>Euphonium</string>
@u27a4
u27a4 / changemode.js
Created January 1, 2018 03:01
Defines change mode command for CodeMirror based on 'addon/search/jump-to-line.js'
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
// Defines changeMode command. Uses dialog.js if present.
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"), require("../dialog/dialog"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror", "../dialog/dialog"], mod);
@u27a4
u27a4 / dice.pegjs
Created July 9, 2018 17:17
Dice notation by PEG.js (https://pegjs.org/)
start
= additive
additive
= left:multiplicative __ "+" __ right:additive {
return {
type: "addexpr", left: left, right: right
}
}
/ left:multiplicative __ "-" __ right:additive {
@u27a4
u27a4 / filetree.c
Last active November 20, 2018 16:10
ファイルツリー for WZ Editor (https://www.wzsoft.jp/)
/**
* .概要
* WZ Editor にファイルツリーを追加するマクロ
*
* .使い方
* フォルダをエディタにドラッグ&ドロップすると、ツールウィンドウにファイル一覧が表示されます。
* ファイル一覧は右クリックメニューの設定から、ワイルドカードを使用してある程度カスタマイズできます。
*
* .導入方法
* このファイルをエディタ(管理者モード)で開き「メニュー > マクロ > プログラムの登録」を実行します。
#include <windows.h>
#include <text.h>
BOOL EventProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, HTEXT source)
{
switch (message)
{
case TWM_EVENT:
switch (wParam)
{
@u27a4
u27a4 / snap.jsx
Created April 14, 2019 13:34
aescript; snap selected layers to the corner in composition.
function snap (x, y)
{
var item = app.project.activeItem;
var layerIndicies = [];
for (var i = 0; i < item.selectedLayers.length; i++)
{
layerIndicies.push(item.selectedLayers[i].index);
}
item.layers.precompose(layerIndicies, item.selectedLayers[0].name, true);
@u27a4
u27a4 / gridarrange.jsx
Created April 21, 2019 14:12
aescript; arrange selected layers in a grid.
function gridarrange(comp, layerIndicies)
{
var d = Math.ceil(Math.sqrt(layerIndicies.length));
var w = comp.width / d;
var h = comp.height / d;
for (var i = 0; i < layerIndicies.length; i++)
{
var x = i % d;
var y = Math.floor(i / d);
@u27a4
u27a4 / replace.jsx
Last active July 22, 2019 14:05
aescript; replace selected item names.
// 入力用ダイアログの表示
function showPrompt(settings, selection) {
var ui = new Window("""dialog {
orientation: 'column',
body: Panel {
orientation: 'column',
alignChildren:'right',
pattern: Group {
orientation: 'row',
_: StaticText { text: 'Find what:' },
@u27a4
u27a4 / isreplaceable.jsx
Created August 4, 2019 17:22
aescript; checking if footages are replaceable with each others.
// JSON_.stringify - from: https://github.com/douglascrockford/JSON-js
"object"!=typeof JSON_&&(JSON_={}),function(){"use strict";var p,l,n,y,e=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;function t(t){return t<10?"0"+t:t}function o(){return this.valueOf()}function a(t){return e.lastIndex=0,e.test(t)?'"'+t.replace(e,function(t){var e=n[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}"function"!=typeof Date.prototype.toJSON_&&(Date.prototype.toJSON_=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+t(this.getUTCMonth()+1)+"-"+t(this.getUTCDate())+"T"+t(this.getUTCHours())+":"+t(this.getUTCMinutes())+":"+t(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON_=o,Number.prototype.toJSON_=o,String.prototype.toJSON_=o),"function"!=typeof JSON_.stringify&&(n={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON_.stringify=functi
@u27a4
u27a4 / asynceach.jsx
Created August 15, 2019 01:11
aescript; non-blocking foreach
// non-blocking foreach
Application.prototype.asyncEach = function(elements, callback, i) {
i = i || 0;
var self = this;
(function () {
if (i < elements.length) {
if (!(callback(elements, i++) === false)) {
self.setTimeout(arguments.callee, 0);
}
}