This file contains 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 strict; | |
use warnings; | |
my $re_paren; | |
$re_paren = qr { | |
\( | |
(?: | |
(?>[^\(\)]+) | |
| (??{ $re_paren }) | |
)* |
This file contains 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
ruby -rdate -e 'diff=(DateTime.parse(ARGV[1]).strftime("%s").to_i-DateTime.parse(ARGV[0]).strftime("%s").to_i).to_r;diff+=86400 if diff<0;diff/=3600;printf "%02d:%02d\n",diff,60*(diff-diff.to_i)' 12:25 23:13 |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>org.karupanerura.startup</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/bin/launchctl</string> | |
<string>setenv</string> |
This file contains 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
public class AsyncExample { | |
public void run () { | |
Client client = new Client(); | |
Listener listener = new Listener () { | |
@Override | |
public void onSuccess (Result result) { | |
...; | |
} | |
}; | |
This file contains 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 strict; | |
use warnings; | |
use utf8; | |
## 定義 | |
my $subref = sub { | |
my ($left, $right) = @_; | |
return $left + $right; | |
}; |
This file contains 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 <stdlib.h> | |
static char *itoa_with_base(register char *p, const size_t len, const int base, const int n) { | |
if (p == NULL || len < 2) return NULL; | |
if (n < base) { | |
const static char chr[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
*p++ = chr[n]; | |
*p = '\0'; | |
return p; |
This file contains 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
# この例ではurl毎にリクエストを行い、その結果が流れてくるストリームをflatmapで処理することで、 | |
# urlごとに作られるストリームを平準化した1つのresponse_streamにまとめてくれる | |
# 非同期な処理だけど同期的に書けて便利 | |
# url_stream: URL -> (flatmap) | |
# response_stream: Response -> (subscribe) | |
url_stream Stream.new | |
response_stream = url_stream.flatmap {|url| | |
stream = Stream.new | |
... # 非同期でHTTPリクエストを行い、レスポンスが得られたらstreamに流してくれる架空のメソッド | |
stream |
This file contains 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
class Foo<T> { | |
func bar(baz: String) -> T { | |
fatalError("This is abstract method.") | |
return // wtf? | |
} | |
} |
This file contains 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
package net.yanzm.profileapplication; | |
import android.animation.Animator; | |
import android.animation.AnimatorListenerAdapter; | |
import android.animation.AnimatorSet; | |
import android.animation.ObjectAnimator; | |
import android.app.Activity; | |
import android.app.AlertDialog; | |
import android.content.DialogInterface; | |
import android.content.Intent; |