This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# vim: fileencoding=utf-8 | |
# AzDrawing2フォーマットのプレビューをbitmapフアイルに吸出し | |
require 'zlib' | |
module AZDWDAT | |
FILEHEADER = "a7c" | |
FILEHEADER_LENGTH = 8 | |
PREVIEW = "SSI" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# vim: fileencoding=utf-8 | |
# AzPainterフォーマットのプレビューをbitmapフアイルに吸出し | |
module AZPDATA | |
FILEHEADER = "a7c" | |
FILEHEADER_LENGTH = 8 | |
INFOHEADER = "ISSSSS" | |
INFOHEADER_LENGTH = 14 | |
PREVIEW = "SSI" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
typedef struct{ | |
char type[7]; | |
char version; | |
} AZPDATA_FILEHEADER; | |
typedef struct{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Zコンビネータ | |
def Z(func) | |
lambda do |f| | |
lambda{|x|lambda{|y| f[x[x]] [y]}}[ | |
lambda{|x|lambda{|y| f[x[x]] [y]}}] | |
end[func] | |
# .callメソッドで書くとこう | |
# lambda do |f| | |
# lambda{|x|lambda{|y| f.call(x.call(x)).call(y)}}.call( | |
# lambda{|x|lambda{|y| f.call(x.call(x)).call(y)}}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define-class <hoge> () | |
((foo :init-value "FOO" :setter set-foo!) | |
(bar :init-value "BAR" :setter set-bar!))) | |
(define hoge (make <hoge>)) | |
(print hoge) ; => #<<hoge> 021b7398> | |
(define-method write-object ((hoge <hoge>) port) | |
(format port "#<<hoge> \"~a\" (~a)>" | |
(slot-ref hoge 'foo) | |
(slot-ref hoge 'bar))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use rfc.http) | |
(use rfc.uri) | |
(define-constant *getthumbinfo-url* "http://ext.nicovideo.jp/api/getthumbinfo") | |
(define-constant *ok-string* "<nicovideo_thumb_response status=\"ok\">") | |
(define-constant *fail-string* "<nicovideo_thumb_response status=\"fail\">") | |
(define-constant *elements* '(title description thumbnail_url watch_url)) | |
(define (getthumbinfo video-id) | |
(receive (code status body) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//自己責任的な方向で | |
chrome.bookmarks.search("アイドルマスター シンデレラガールズ", | |
function(nodes){ | |
var re = /(?:Fbattle_check%2F|show%2F)(\d+)/; | |
var arr = []; | |
for(i in nodes){ | |
if (nodes[i].url.match(re)){ | |
arr.push([nodes[i], RegExp.$1]); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// コスト比を計算して表示を追加 | |
// いろいろと自己責任の方向で | |
var tdNodes = $('div#top > table tbody tr td + td'); | |
for(i in tdNodes){ | |
if (tdNodes[i].childNodes && | |
tdNodes[i].childNodes.length > 12 && | |
tdNodes[i].childNodes.length < 25){ | |
var cost = parseInt(tdNodes[i].childNodes[6].nodeValue); | |
var attack = parseInt(tdNodes[i].childNodes[10].nodeValue); | |
var defence = parseInt(tdNodes[i].childNodes[12].nodeValue); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fnc = function(str){console.log(this.name + ": " + str)}; | |
obj = {name: "HOGE"}; | |
arg = ["hi!"]; | |
fnc.apply(obj, arg); // => HOGE: hi! | |
// fnc(arg) を obj に適用するって意味かなぁ | |
fnc.apply({name: "FOO"}, ["hello!"]); // => FOO: hello! | |
fnc.apply({name: "BAR"}, ["bood by!"]); // => BAR: bood by! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- svnの作業dirでurlを、そしてgitの作業dirでbranch名をプロンプトに出力 | |
function nyaos.prompt(prompt) | |
local current = nyaos.eval('__pwd__') | |
if nyaos.access(current .. '/.svn/entries', 0) then | |
local svn_url = string.match(nyaos.eval('svn info --xml'), '<url>(.*)</url>', 1) | |
return true, '$e[36;40;1mSVN[' .. svn_url .. ']' .. prompt | |
else | |
local git_path = current | |
repeat | |
if nyaos.access(git_path .. '/.git', 0) then |