This file contains hidden or 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 Switch { | |
public static void main(String[] args) { | |
switch ("a") { | |
case "a": | |
System.out.println("A"); | |
break; | |
case "b": | |
System.out.println("B"); | |
break; |
This file contains hidden or 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
module ActiveRecord | |
module ConnectionAdapters | |
class AbstractAdapter | |
# Will return the given strings as a SQL concationation. By default | |
# uses the SQL-92 syntax: | |
# | |
# concat('foo', 'bar') -> "foo || bar" | |
def concat(*args) | |
args * " || " |
This file contains hidden or 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
/** | |
* <省略> | |
* | |
* @deprecated 推奨しない理由 | |
* @see #method(Long, String) <- 代替メソッド | |
*/ | |
@Deprecated | |
public void method() |
This file contains hidden or 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
/* 実装 */ | |
var StringUtils = function() {} | |
StringUtils.prototype = { | |
replace : function(str,from,to) { | |
実装 ~省略~ | |
} | |
}; | |
/* 使い方 */ |
This file contains hidden or 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
FOR /L %%i IN (0,1,200) DO echo %%i & java -cp %CLASSPATH% %EXEC_CLASS% |
This file contains hidden or 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 FooController < ApplicationController | |
def index | |
@items = Item.all | |
end | |
def new | |
@item = Item.new | |
end |
This file contains hidden or 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
Product.where(category: "MP3 Player").group(:maker).order('count_maker desc').count('maker').keys |
This file contains hidden or 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
<html> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
</head> | |
<body> | |
<input id="in1" type="text" value ="山田"> | |
<div id="out" ></div> |
This file contains hidden or 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
def count_word_from_file(path: "~/default.txt", word:"default") | |
file = File.read(path) | |
return file.split.select{|w| w==word}.size | |
end |
This file contains hidden or 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
require 'date' | |
def each_fridays | |
friday = Date.new(2013,1,4) | |
loop do | |
yield friday | |
friday += 7 | |
end | |
end | |
fridays = enum_for(:each_fridays) |