Skip to content

Instantly share code, notes, and snippets.

View yoshiori's full-sized avatar
🏠
Working from home

Yoshiori Shoji yoshiori

🏠
Working from home
View GitHub Profile
Java のコードを
pythonista に持ち込む:まぁ、Java も書けなくはないけどね
rubyist に持ち込む:ツマラン、どこかに細工してやろうか・・・
perler に持ち込む:出てけゴルァァァァァァァァァァァ!!
Python のコードを
Java エンジニアに持ち込む:おぅ、Python のコードか
rubyist に持ち込む:スクリプト言語の僚友だ、バッチリ直してやるぜ
perler に持ち込む:けっ、優等生か
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
public class Scripting {
public static void main(String[] args) throws Exception{
ScriptEngine engin = new ScriptEngineManager().getEngineByName("JavaScript");
engin.eval("print(\"Hello JavaScript!!\");");
}
group :test, :development do
gem 'rspec-rails'
gem 'guard'
gem 'guard-rspec'
gem 'growl', :require => false # for Mac
gem 'libnotify', :require => false # for *nix
end
@yoshiori
yoshiori / yomikata.rb
Created July 25, 2012 11:08
$ruby yomikata.rb 2 yomikata シーサーフ
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
require 'net/http'
def increment(word,pronounce)
http = Net::HTTP.new('yomikata.org')
response = http.post('/ajax/vote.php', "pronounce=#{pronounce}&word=#{word}", 'User-Agent' => 'yoshiori@gmail.com')
puts "increment #{pronounce}/#{word}"
end
@yoshiori
yoshiori / coderwall.html
Created July 12, 2012 07:54
octopress coderwall badges
{% if site.coderwall_user %}
<section class="well">
<ul class="nav">
<li class="nav-header">Coderwall Badges</li>
</ul>
<div id="coderwall_badges"></div>
<a href="http://coderwall.com/{{site.coderwall_user}}">@{{site.coderwall_user}}</a> on coderwall
<script type="text/javascript">
$(document).ready(function(){
$.getJSON("http://coderwall.com/{{site.coderwall_user}}.json?callback=?", function(data){
@yoshiori
yoshiori / logback.xml
Created June 27, 2012 04:58
turboFilter marker sample
<turboFilter class="ch.qos.logback.classic.turbo.MarkerFilter">
<Marker>MarkerExample</Marker>
<OnMatch>DENY</OnMatch>
</turboFilter>
@yoshiori
yoshiori / gist:2835411
Created May 30, 2012 10:38 — forked from yamashiro/gist:2835272
Traitつき無名クラス
import org.specs2.mutable._
trait BarTrait {}
class Hoge {}
class TraitGetClassTest extends Specification {
"Trait mixin " should {
"getClass " in {
val hoge = new Hoge with BarTrait
hoge.isInstanceOf[Hoge] must beTrue
}
}
@yoshiori
yoshiori / gist:2646399
Created May 9, 2012 16:38
単に評価順じゃね???
scala> val txt = "foo" + "bar" match { case s => {println(s);s} }
foobar
txt: java.lang.String = foobar
scala> val txt = "foo" + ("bar" match { case s => {println(s);s} })
bar
txt: java.lang.String = foobar
だから
@yoshiori
yoshiori / main.scala
Created March 28, 2012 06:12
括弧省略
object Main {
def main(args: Array[String]){
Main puts "Main"
this puts "this"
// puts "foo" これがダメなのなんで???
}
def puts(text:String){
println(text)
}
}
@yoshiori
yoshiori / gmb.rb
Created March 22, 2012 06:35
github の README.rdoc をサクっとプレビューしたい
#!/usr/bin/env ruby
require 'github/markup'
require 'tempfile'
if ARGV[0] && File.exists?(file = ARGV[0])
html = GitHub::Markup.render(file)
tmp = Tempfile::new(['','.html'])
tmp.write(html)
tmp.close