Skip to content

Instantly share code, notes, and snippets.

View sassembla's full-sized avatar
😍
be gentle.

Toru sassembla

😍
be gentle.
View GitHub Profile
@sassembla
sassembla / ShiftJSON
Created February 4, 2014 12:33
キモいDSL
"transform<-path, crossed, messages": {
"code": "
import os\n
name = os.path.basename(inputs[\"path\"])\n
onselected = []\n
messages = inputs[\"messages\"]\n
for message in messages:\n
// ログの内容を流し込むとエディタ上に表示したりするやつ。
defineFilter: {
"name": "unity",
"filters": [
{
// log line of error
"(.*)[(]([0-9].*?),.*[)]: error .*: (.*)": {
"injects": {
"groups[0]": "name",
// かっこの数が合わない
task hello {
doLast {
println 'Hello world!'
}
// actual
gradle -m clean compile
// shader error & warning
{
// Shader error in 'Custom/TestShader': Parse error: syntax error at line 9
"Shader error in [']Custom/(.*)[']: (.*) at line ([0-9].*)": {
"injects": {
"groups[0]": "name",
"groups[1]": "message",
"groups[2]": "line"
},
"selectors": [
@sassembla
sassembla / Simple Assertion in Unity
Last active August 29, 2015 14:02
Simple Assertion in Unity.
static class Assertions {
/**
assert which extends bool.
usage:
(0 < transform.position.y).Assert("fall in negative.");
*/
public static void Assert (this bool condition, string reason) {
if (condition) return;
@sassembla
sassembla / TimeAssertForUnity
Last active August 29, 2015 14:02
TimeAssert for Unity
/*
example
"2014/06/23 3:05:34".TimeAssert(30, "time over!");
*/
using System;
using System.Globalization;
using UnityEngine;
static class Assertions {
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
/**
仮。もっと小さくしたい。
ネームスペースごとに、扱える数が異なる。
*/
@sassembla
sassembla / LogWriter.cs
Created February 25, 2015 14:35
LogWriter
using UnityDebug = UnityEngine;
using System.IO;
using System.Text;
using System.Diagnostics;
public class LogWriter {
private static string targetPath = string.Empty;
public static void StartTransLogging (string path) {
@sassembla
sassembla / context.lua
Created March 8, 2015 09:33
nginx + lua で複数クライアント接続での合同contextみたいなやつ
--[[]
ゲームとか書けるところ。あとコンテキストの名の通り、データベースに依存せずにパラメータとか持てるぞ。
]]
local M = {}
function M.onConnect(from, publish)
ngx.log(ngx.ERR, "connect from:", from)
end
-- Disque client for lua.
local sub = string.sub
local byte = string.byte
local tcp = ngx.socket.tcp
local concat = table.concat
local null = ngx.null
local pairs = pairs
local unpack = unpack
local setmetatable = setmetatable