This file contains 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 'open3' | |
API_URL = 'https://stream.twitter.com/1/statuses/sample.json' | |
USER = 'Twitter_account' | |
PW = 'password' | |
INTERVAL_SECONDS = 10 | |
stdin, stdout, stderr = *Open3.popen3("curl #{API_URL} -u#{USER}:#{PW}") | |
line_count = 0 |
This file contains 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
package helpers; | |
import play.db.jpa.JPA; | |
import play.db.jpa.JPAPlugin; | |
/** | |
* トランザクションを一時的に切り替える機能を提供します。 | |
* <p> | |
* トランザクションの切り替え・切り戻しは内部で自動的に行われます。 | |
* </p> |
This file contains 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
package biz.k11i.util; | |
import java.util.Calendar; | |
import java.util.Date; | |
import java.util.Iterator; | |
import java.util.NoSuchElementException; | |
/** | |
* Date オブジェクトの任意のフィールドをインクリメントしながら繰り返す Iterator の実装です。 | |
* <p> |
This file contains 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' | |
# | |
# 指定された日付が、その月において何週目にあたるのかを計算し、返却します。 | |
# | |
# 週始まりは月曜です。初週を 1 としています。 | |
# | |
def week_of_month(date) | |
first_week = (date - (date.day - 1)).cweek | |
this_week = date.cweek |
This file contains 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 static List<String> tokenize(String str) { | |
if (str == null || str.isEmpty()) { | |
return Collections.emptyList(); | |
} | |
ArrayList<String> tokens = new ArrayList<String>(); | |
int i = 0; | |
char[] chars = str.toCharArray(); | |
while (i < chars.length) { |
This file contains 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 static List<String> tokenize(String str) { | |
if (str == null || str.isEmpty()) { | |
return Collections.emptyList(); | |
} | |
ArrayList<String> tokens = new ArrayList<String>(); | |
int i = 0; | |
char[] chars = str.toCharArray(); | |
while (i < chars.length) { |
This file contains 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
package helpers; | |
import java.util.Collections; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.NoSuchElementException; | |
import play.db.jpa.GenericModel.JPAQuery; | |
/** |
This file contains 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
# -*- coding: utf-8 -*- | |
require 'MeCab' | |
class MeCabTagger | |
class MeCabNode | |
def initialize(node, charset) | |
@node = node | |
@feature = node.feature.force_encoding(charset).split(',') | |
@charset = charset |
This file contains 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
#--- | |
# child.sh | |
echo "export MESSAGE=hello" | |
#--- | |
# parent.sh | |
`sh child.sh` |
This file contains 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
package hoge; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.NoSuchElementException; | |
import java.util.Stack; | |
public interface Retrievable<T extends Retrievable> extends Iterable<T> { | |
List<T> children(); | |