Skip to content

Instantly share code, notes, and snippets.

View ne-sachirou's full-sized avatar

さっちゃん ne-sachirou

View GitHub Profile
@ne-sachirou
ne-sachirou / jruby-midi.rb
Created March 24, 2011 00:38
JRuby1.6でMIDI Yokeへnoteを送る
include Java
include_class javax.sound.midi.MidiSystem
include_class javax.sound.midi.ShortMessage
# License: Public Domain
notes = [62, [60, 64, 67], 62, 64,
[64, 67], [64, 67], 62, 62,
60, 60, 60, 62,
[60, 64], [60, 64], [60, 64], 60]
@ne-sachirou
ne-sachirou / unzip.js
Created March 27, 2011 23:46
Simple unzip by Ruby and by JScript.
// http://d.hatena.ne.jp/hetappi/20080819/1219157144
function unzip(zipfile, // @param String: Zipped file path
unzipdir) { // @param String: Unzip target directory path
var fso = new ActiveXObject('Scripting.FileSystemObject'),
shell = new ActiveXObject('Shell.Application'),
dst, zip;
if (!unzipdir) {
unzipdir = '.';
}
@ne-sachirou
ne-sachirou / NGID.js
Created April 7, 2011 13:42
NGID.js #AzureaScript
// ==AzureaScript==
// @name ne_NGID
// @author http://c4se.sakura.ne.jp/profile.html
// @scriptUrl https://gist.github.com/raw/907791/
// @date 2011-04-07
// @license Public Domain
// ==/AzureaScript==
// == Usage
// Write [user.ne_NGID] section & NGID field to Azurea.ini
@ne-sachirou
ne-sachirou / DirecMessage.g.js
Created April 13, 2011 12:50
ダイレクトメッセージを受信したときのイベントハンドラが欲しい #AzureaScript
// @author http://c4se.sakura.ne.jp/profile/ne.html
// @date 20110413
// @license Public Domain
(function(k){function h(){var c,d,b,a;f.callRefresh();c=f.getItemByOrder(0);if(!(!c||c.id===e)){c=f.items;a=false;if(e){d=0;for(b=c.length;d<b;++d)if(c[d].id===e){a=true;break}}for(e=a?c[d].id:c[0].id;d--;){b=c[d].status;a=g.receiveMessage;for(var i=a.length;i--;)a[i](b)}j(h,3E5)}}var j=System.setTimeout,f=System.views.getView(2),e=0,g={receiveMessage:[]};j(h,5E3);k.DirectMessage={addEventListener:function(c,d){var b=g[c],a;if(b){for(a=b.length;a--;)b[a]===d&&b.splice(a,1);b.push(d)}},removeEventListener:function(c,
d){var b=g[c],a;if(b)for(a=b.length;a--;)if(b[a]===d){b.splice(a,1);break}}}})(this);
@ne-sachirou
ne-sachirou / es5.js
Created June 10, 2011 14:36
Define ES5 extention by ES3 #js
/**
* @preserve Public Domain 2011 ne_Sachirou
* author: ne_Sachirou http://c4se.tk/profile/ne.html
* site: http://gist.github.com/1018954
* date: 2011 - 2012
* license: Public Domain
*/
//java -jar compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --js_output_file es5.min.js --js es5.js --js json2.js
// [Twitter / @ichitaso: @ne_sachirou 教えて欲しいこと:アメブロのタイトル下に http://bit.ly/lGFPAs のScriptを使用してはてブ、ツイッター、いいね!ボタンを設置してるんだけど、これにtumblrの共有ボタン http://bit.ly/jGkpvS を追加したい]( https://twitter.com/#!/ichitaso/status/79376845392457728 ,"")
// [Twitter / @ichitaso: @ne_sachirou アメブロはヘッドタグいじれないので、$.getScript("http://platform.tumblr.com/v1/share.js"); と記述して、var tumblur_btn = '<a href="~ って感じで記述しても表示しなかった]( https://twitter.com/#!/ichitaso/status/79378233409273856 ,"")
(function () {
var TWITTER_ID = 'ne_sachirou',
BLOG_TITLE = ' - Sachirou InoueのBlog';
if (!(/Trident|Firefox/i.test(navigator.userAgent))) {
navigator.userAgent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.91 Safari/534.30';
@ne-sachirou
ne-sachirou / cl11_06.c
Created June 21, 2011 03:13
Draw figures on the console.
/*
* (C)2011 ne_Sachurou [email protected]
* cf. https://gist.github.com/1037166
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#encoding = utf-8
desc 'Compile js files.'
task 'compile' do |t|
SCRIPTS_DIR = './'
COMPILER_PATH = SCRIPTS_DIR + 'compiler.jar'
{
'textcut.g' => ['textcut']
}.each do |key, value|
sh "java -jar #{COMPILER_PATH} --compilation_level SIMPLE_OPTIMIZATIONS " +
if (location.href.match(/^.+\/entry[\-0-9]*\.html$/g) || // 記事ページ
location.href.match(/^.+\/entry[\-0-9]*\.html\#cbox$/g)) { // コメントをクリックして入る記事ページ
document.write('<script>' +
'var linkwithin_site_id = 362768;' +
'var linkwithin_text = "他にもこんな記事があります";' +
'</script>' +
'<script src="http://www.linkwithin.com/widget.js"></script>');
}
@ne-sachirou
ne-sachirou / cmdrc.bat
Created August 4, 2011 05:57
.cmdrc bat file
@echo off
doskey alias=if "$1"=="" (doskey /macros) else ^
for /f "delims== tokens=1,*" %%i in ("$*") do^
@if "%%j" neq "" (^
doskey $*^
) else (^
doskey /macros ^| findstr /b /c:"%%i="^
)