Skip to content

Instantly share code, notes, and snippets.

View sunny4381's full-sized avatar

NAKANO Hideo sunny4381

  • 株式会社ウェブチップス
View GitHub Profile
@sunny4381
sunny4381 / how-to-buid-jquery-ui.md
Last active February 2, 2021 04:17
How to build jquery-ui

How to build jquery-ui

Setup Environment

anyenv

jquery-ui のビルドには node と java が必要です。 node は nodenv を用いてインストールします。 java は brew でインストールするのですが容易にバージョン切り替えできるようにしておいた方が良いと思うので jenv もインストールして java のバージョンを切り替えられるようにします。

@sunny4381
sunny4381 / 外部コマンドの実行
Last active February 11, 2018 11:09
Ruby で外部コマンドの非同期実行
# 外部プログラムを非同期実行する場合、以下の様な方法で実行する場合が多いと思います。
require "open3"
stdin, stdout, stderr = Open3.popen3(cmd)
# cmd の実行に時間がかかる場合、stdin, stdout, stderr が GC により閉じられる確率が高くなります。
# GC により閉じられた stderr に cmd が書き込むと EPIPE 例外が発生し、cmd が異常終了します。
# そこで、stdin, stdout, stderr が不要な場合は閉じておくほうがいいです。
require "open3"
Open3.popen3("#{cmd} > /dev/null 2>&1")
@sunny4381
sunny4381 / gist:84d845d5ca97a5920c85
Last active February 19, 2016 12:09
Strong Parameter で Unpermitted parameters と表示された時の Rails Console での検証方法
Rails Console で次のコマンドを試す
```ruby
very_complicated_post = {
"item" => {
"point"=>{
"loc"=>{
"lng"=>"138.08578491210937",
"lat"=>"36.24584590837756"},
"zoom_level"=>"10" } } }
@sunny4381
sunny4381 / file0.scala
Created February 26, 2013 11:24
Play Framework の Iteratee/Enumerator/Enumeratee の使用例 ref: http://qiita.com/items/a711fa72db26c9263b3f
// 合計を計算する Iteratee (初期値は 0)
val initialValue: Int = 0
val sumIteratee: Iteratee[Int, Int] = Iteratee.fold(initialValue) { (total, e) => total + e }
// 1, 234, 455, 987 を要素にもつ Enumerator
val intEnumerator1: Enumerator[Int] = Enumerator(1, 234, 455, 987)
// intEnumerator1 の合計を計算する
val futureTotal1: Future[Int] = intEnumerator1.run(sumIteratee)
val total1: Int = Await.result(futureTotal1, Duration.Inf)
println("total=" + total1.toString)
@sunny4381
sunny4381 / sample.rb
Created February 25, 2013 00:24 — forked from miyucy/sample.rb
port = 10051
s = Zabbix::Sender.new 'zabbix-server', port
pp s.send('host', 'key', 'value')
# => {"response"=>"success",
# "info"=>"Processed 1 Failed 0 Total 1 Seconds spent 0.000042"}
pp s.to('host') {
send 'key', 'value'