Skip to content

Instantly share code, notes, and snippets.

View yohm's full-sized avatar

Yohsuke Murase yohm

View GitHub Profile
@yohm
yohm / gist:3104565
Created July 13, 2012 12:06
first F# fizzbuzz code
let list1 = [1..100]
let to_str i =
if (i%15) = 0 then "fizzbuzz"
else if (i%5) = 0 then "buzz"
else if (i%3) = 0 then "fizz"
else (string) i
let list2 = List.map to_str list1
@yohm
yohm / sample_feature_spec.rb
Last active December 17, 2015 05:48
capybaraを使ってfeature specを書いてみた。
require 'spec_helper'
describe "simulators pages", js: false do
before(:each) do
@sim = FactoryGirl.create(:simulator,
parameter_sets_count: 1,
runs_count: 3,
analyzers_count: 0
)
@yohm
yohm / count_word.rb
Last active August 29, 2015 13:57
count_word
str = "no ruby, no life!"
h = {}
str.scan(/\w+/).each do |word| h[word] = h[word].to_i + 1 end
h
import x10.glb.ArrayListTaskBag;
import x10.glb.TaskQueue;
import x10.glb.TaskBag;
import x10.glb.GLBParameters;
import x10.glb.GLB;
import x10.util.Team;
import x10.glb.Context;
import x10.glb.ContextI; // ContextI : Interface for Context
import x10.glb.GLBResult;
@yohm
yohm / private.xml
Created January 14, 2015 03:22
My private.xml of Karabiner
<?xml version="1.0"?>
<root>
<appdef>
<appname>iTERM2</appname>
<equal>com.googlecode.iterm2</equal>
</appdef>
<appdef>
<appname>MACVIM</appname>
<equal>org.vim.MacVim</equal>
</appdef>
@yohm
yohm / StaticTasks.x10
Last active August 29, 2015 14:13
minimum GLB
import x10.util.ArrayList;
import x10.glb.ArrayListTaskBag;
import x10.glb.TaskQueue;
import x10.glb.TaskBag;
import x10.glb.GLBParameters;
import x10.glb.GLB;
import x10.util.Team;
import x10.glb.Context;
import x10.glb.ContextI;
import x10.glb.GLBResult;
@yohm
yohm / ParallelSystem.x10
Created January 23, 2015 08:52
GLBで並列に外部コマンドを実行するサンプル
import x10.util.ArrayList;
import x10.glb.ArrayListTaskBag;
import x10.glb.TaskQueue;
import x10.glb.TaskBag;
import x10.glb.GLBParameters;
import x10.glb.GLB;
import x10.util.Team;
import x10.glb.Context;
import x10.glb.ContextI;
import x10.glb.GLBResult;
@yohm
yohm / GlbGlobalRef.x10
Created February 4, 2015 01:59
GLBで実行した結果をGlobalRefで参照している変数に集めようとしている。しかし複数placeだとデッドロックする
import x10.util.ArrayList;
import x10.glb.ArrayListTaskBag;
import x10.glb.TaskQueue;
import x10.glb.TaskBag;
import x10.glb.GLBParameters;
import x10.glb.GLB;
import x10.util.Team;
import x10.glb.Context;
import x10.glb.ContextI;
import x10.glb.GLBResult;
@yohm
yohm / Point01.x10
Created April 26, 2015 06:33
A sample of x10 Point class
class Point01 {
static def p( o: Any ) {
Console.OUT.println( o );
}
public static def main( args: Rail[String] ) {
Console.OUT.println("hello");
// construct a 1-d point from Long
@yohm
yohm / Region01.x10
Created April 27, 2015 05:22
A sample of Region of x10
import x10.regionarray.Region;
class Region01 {
private static def p( o: Any ) {
Console.OUT.println( o );
}
public static def main( args: Rail[String] ) {
val r1 = Region.make( 1..10 );