Skip to content

Instantly share code, notes, and snippets.

@takkkun
takkkun / Gemfile
Created February 28, 2012 14:52 — forked from rummelonp/Gemfile
guard で *.less と *.coffee 監視してコンパイル
source 'http://rubygems.org'
gem 'guard'
gem 'guard-less'
gem 'guard-coffeescript'
@takkkun
takkkun / gist:2048256
Created March 16, 2012 02:51
alc.co.jp cli (enja, jaen)
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'nokogiri'
require 'stringio'
require 'open-uri'
begin
require 'rainbow'
rescue LoadError
import scala.util.matching.Regex
class StringValidator(strings: List[String]) {
var or = false
var not = false
var result = true
def judge = result
def and = self(or = false)
trait Vector[V <: Vector[V]] extends Product {
def +(vector: V): V
def *(vector: V): V
def *(coefficient: Double): V
def toList: List[Double]
def innerProduct(vector: V) = (this * vector).toList.reduceLeft(_ + _)
}
case class Vector1D(_1: Double) extends Vector[Vector1D] {
(function($) {
$(document).on('mousemove', function mousemove() {
// 動かしたり
});
$(document).on('mouseup', function mouseup() {
$(this).off('mouseup', mouseup); // こっちはOK
$(this).off('mousemove', mousemove); // こっちが参照出来ない
});
})(jQuery);
This file has been truncated, but you can view the full file.
trait Matrix
trait SquareMatrix[M <: SquareMatrix[M]] {
def inverse(): Option[M]
}
trait Rows1
trait Rows2
trait Rows3
trait Rows4
# -*- coding: utf-8 -*-
OFFENCE = 150 # 自分の攻コスに変更
DEFENCE = 150 # 自分の守コスに変更
# 手持ちのアイドルを並べてく
IDOLS = [
['[孤高の歌姫] 如月千早+', 13516, 10972, 14], # [名前, 攻, 守, コスト] の順で書く
['[麗しの花嫁] 和久井留美+', 8891, 6416, 10],
['[博識子女] 古澤頼子+', 10493, 10493, 12],
# 1. src/**/*.txtにマッチするファイル(例: src/hello/goodbye.txt)を探し
# 2. マッチしたファイルを:targetオプションに指定した方法で目的のファイル名(例: work/hello/goodbye.normalized.txt)を求め
# 3. `file 目的のファイル名 => マッチしたファイル名`というタスクを作る
#
# ってことがしたい。ちなみにgenerate_fromの返り値は目的のファイル名の一覧
work_files = generate_from 'src/**/*.txt', :target => ['work', :dirname, :filename, '.normalized.txt'] do |t|
sh "./normalize #{t.from} #{t.to}" # ./normalize-text-file src/hello/goodbye.txt work/hello/goodbye.normalized.txt
end
# 直前のタスクの定義で得たファイル名の一覧を使ってさらにタスクを定義したり
#!/usr/bin/env escript
main([Query|_]) ->
case matcher(Query) of
{ok, Matcher} ->
print(lists:filter(Matcher, http_statuses()));
{error, {Message, Position}} ->
io:format("Error: ~s at ~p character~n", [Message, Position])
end;
@takkkun
takkkun / example.rb
Last active December 14, 2015 04:29
puts 1
puts %w(hello world) * ' '
puts %w(h l t).join('igh')