Glide is the easiest way to create useful slide for all of your Gists.
- input key
<-to go backward. - input key
->to go forward.
| import scala.util.parsing.combinator.JavaTokenParsers | |
| object ParserSample extends JavaTokenParsers { | |
| /* | |
| * RegexParserで定義されたメソッド。 | |
| * default(=true) だと行末の改行などが無視される。 | |
| */ | |
| override def skipWhitespace = false | |
| /* |
| CC = gcc | |
| OPT = -O2 -Wall | |
| BIN = stat_test | |
| default: bin | |
| bin: $(BIN) | |
| stat_test: stat_test.o | |
| $(CC) $(OPT) -o $@ $< |
| #include <stdio.h> | |
| #include <time.h> | |
| void print_time(const time_t t) | |
| { | |
| char buf[128]; | |
| size_t str_size = 0; | |
| str_size = strftime(buf, 127, "%Y/%m/%d %H:%M:%S", localtime(&t)); | |
| buf[str_size] = 0; |
| import scala.concurrent._ | |
| /* futureを使うときにExecutionContextが必要。 */ | |
| implicit val execctx = ExecutionContext.global | |
| /* futureはscala.concurrentパッケージに定義されているシンタックスシュガー */ | |
| val a = future { Thread sleep 100000 ; "hoge" } | |
| /* 次のFutureの処理を合成 */ | |
| val b = a flatMap ( (str:String) => future { "fuga" + str } ) |
| // ==UserScript== | |
| // @name Amazon Shorten URL Clipper | |
| // @namespace https://gist.github.com/mather | |
| // @version 0.4 | |
| // @updateURL https://gist.github.com/mather/5458140/raw/amazon_shorten.user.js | |
| // @description Amazon商品のショートURLを作成して、商品名を含めたツイートボタンを作成します。 | |
| // @match http://www.amazon.co.jp/* | |
| // @match http://www.amazon.com/* | |
| // @copyright 2013+, mather | |
| // ==/UserScript== |
| /* util パッケージで宣言する場合 */ | |
| package object util { | |
| import java.sql.Timestamp | |
| import com.github.nscala_time.time.Imports.DateTime | |
| import scala.slick.lifted.MappedTypeMapper | |
| /* 結果値 Timestamp をアプリケーションでは DateTime に変換して使う */ | |
| implicit def dateTimeMapper = MappedTypeMapper.base[DateTime,Timestamp]( | |
| /* f: DateTime -> Timestamp */ | |
| dt => new Timestamp(dt.getMillis), |
| # -*- encoding: utf-8 -*- | |
| def fib_cycle(q,a,b) | |
| fib = [a,b] | |
| fib_array = [fib] | |
| while true | |
| fib = [fib[1], (fib[0] + fib[1]) % q] | |
| if (index = fib_array.index(fib)) | |
| break | |
| else |
| --- a/Library/Formula/subversion.rb | |
| +++ b/Library/Formula/subversion.rb | |
| @@ -2,8 +2,8 @@ require 'formula' | |
| class Subversion < Formula | |
| homepage 'http://subversion.apache.org/' | |
| - url 'http://www.apache.org/dyn/closer.cgi?path=subversion/subversion-1.8.3.tar.bz2' | |
| - mirror 'http://archive.apache.org/dist/subversion/subversion-1.8.3.tar.bz2' | |
| + #url 'http://www.apache.org/dyn/closer.cgi?path=subversion/subversion-1.8.3.tar.bz2' | |
| + url 'http://archive.apache.org/dist/subversion/subversion-1.8.3.tar.bz2' |
| from fabric.api import * | |
| @task | |
| def copy_id(file="~/.ssh/id_rsa.pub"): | |
| """Identityをauthorized_keysに追加する""" | |
| put(file, "/tmp/id.pub") | |
| try: | |
| run("if [ ! -d ~/.ssh ]; then mkdir -p ~/.ssh; fi") | |
| run("if [ ! -f ~/.ssh/authorized_keys ]; then cp /tmp/id.pub ~/.ssh/authorized_keys && chmod 0600 ~/.ssh/authorized_keys; fi") | |
| run("cat ~/.ssh/authorized_keys /tmp/id.pub | sort -u > /tmp/uniq.authorized_keys") |