Skip to content

Instantly share code, notes, and snippets.

View tosik's full-sized avatar
🏠
Working from home

Toshiyuki Hirooka tosik

🏠
Working from home
  • Tokyo, Japan
View GitHub Profile
# coding: utf-8
require 'cinch'
def unko
"💩"
end
def shit
unko
end

Ant ビルドファイルのリファクタリング

ThoughtWorks アンソロジーの 10章 Ant ビルドファイルのリファクタリング p154 の項目抜き出し

  • macrodef の抽出
  • ターゲットの抽出
  • 宣言の導入
  • 依存による call の置き換え
  • filtersfile の導入
  • プロパティファイルの導入
@tosik
tosik / main_context.coffee
Created September 7, 2013 04:01
こんな風に Context#commandMap で WHEN the event happened THEN execute this command が実現できるようにした
_module_ 'App.Main', ->
class @MainContext extends Base.Context
startup: ->
@commandMap.when(@startupDone).then(App.Main.SayHelloCommand)
shutdown: ->
@tosik
tosik / object-to-int.as
Created July 29, 2013 07:45
valueOf を使わずに Object が int に変換される例
package
{
import flash.display.Sprite;
public class Main extends Sprite
{
public function Main()
{
trace(int(new Foo).valueOf()); //=> 123
}
@tosik
tosik / object-to-int-1.as
Created July 29, 2013 07:16
object や primitive と valueOf を絡めた AS3 のコンパイラとランタイムの挙動について
var object:* = new Object;
var foo:int = object;
trace(foo); //=> 0
@tosik
tosik / terminal.sh
Last active December 20, 2015 08:39
why does elixir output the warning 'variable x is unused' ?
% elixir main.exs
> unused_x_variableain.exs:4: variable x is unused
> foo
@tosik
tosik / Gruntfile.coffee
Created July 26, 2013 07:51
rust run main.rs grunt task
module.exports = (grunt) ->
grunt.loadNpmTasks 'grunt-exec'
grunt.initConfig
exec:
rustrun:
command: 'rust run main.rs'
grunt.registerTask 'default', ['exec:rustrun']
@tosik
tosik / gist:5632979
Last active December 17, 2015 15:39
#!/usr/bin/env ruby
require 'carrier-pigeon'
require 'json'
require 'pp'
command = <<EOS
ssh gerrit.example.com gerrit stream-events
EOS
IO.popen(command, 'r+') do |io|
@tosik
tosik / gist:5632905
Created May 23, 2013 05:19
なぜか動かない jq がパイプしてくれないっぽい?
ssh gerrit.example.com -p 29418 gerrit stream-events | jq '.|select(.type == "comment-added")|{comment, url: .change.url}|.[]' --raw-output | ruby -e "require 'carrier-pigeon'; loop { message = STDIN.gets; if message then CarrierPigeon.send(uri: 'irc://gerrit:[email protected]/#gerrit', message: message, ssl:true, notice:true, join:true) ; p message ;end }"
@tosik
tosik / dfault.scss
Last active December 15, 2015 08:28
button {
label {
position: 0 0;
}
image-view {
position: 0 0;
}
}