Skip to content

Instantly share code, notes, and snippets.

View satoryu's full-sized avatar
🤘
Put your 🦊 up!

Tatsuya Sato satoryu

🤘
Put your 🦊 up!
View GitHub Profile
@satoryu
satoryu / tablesyntax_prototype.rb
Last active July 13, 2019 14:21
Prototype of Table Syntax
class Table
attr_reader :header, :rows
def initialize(header, rows)
@header = header
@rows = rows
end
end
class Row
def remove_first_and_last_letters(str)
return '' if str.length <= 2
str[1..-2]
end
puts remove_first_and_last_letters('foo')
puts remove_first_and_last_letters('hi')
puts remove_first_and_last_letters('x')
puts remove_first_and_last_letters('xHello, world!D')
@satoryu
satoryu / process_fork.rb
Last active June 21, 2019 02:26
Spike code to confirm how Process and its fork work
chpid = Process.fork do
10.times do
STDOUT.puts "Foo"
sleep 1
end
end
puts "Child process started"
Process.waitpid(chpid)
puts "End"
const exampleValues = [2, 15, 8, 23, 1, 32];
const result = exampleValues.reduce(({truthyValues, falseyValues}, exampleValue) => {
if (exampleValue > 10) {
truthyValues.push(exampleValue);
return { truthyValues, falseyValues };
}
falseyValues.push(exampleValue);
package main
import "fmt"
type Person struct {
Name string
}
func (p Person) Greeting() string {
return fmt.Sprintf("Hello, %v!", p.Name)
@satoryu
satoryu / random.md
Last active October 1, 2020 15:03
ネタ帳

ネタ帳

作りたいものリスト。

  • 勉強会などで特定のハッシュタグで連続してツイートしやすいTwitterクライアント
    • 勉強会で指定されたタグを一度入力したら、あとは思ったことをtsudaるだけ、にしたい。
    • 勉強会主催者が、予めハッシュタグを固定した投稿ページのURLを作って公開できるとタグの間違いが減りそう。
      • 勉強会の告知サイトに掲載できるとよさげ。
  • stringカラムが期待したURLかどうかをチェックするrailsのvalidator
  • 既にある https://github.com/perfectline/validates_url
@satoryu
satoryu / golang.md
Last active May 23, 2019 08:47
Memo about go lang
package main
import (
"fmt"
"time"
)
func Screaming(names <-chan string, control <-chan bool) {
ticker := time.Tick(500 * time.Millisecond)
for {
package main
import (
"fmt"
"golang.org/x/tour/tree"
)
// 1.
// Walk walks the tree t sending all values
// from the tree to the channel ch.