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
<?php | |
/* !! 入力配列の中にある数値添字要素の添字の数値は、 結果の配列ではゼロから始まる連続した数値に置き換えられます。 */ | |
$a = array( | |
'a' => 'aaa', | |
'100' => '100100100', | |
); | |
$b = array( | |
'b' => 'bbb', |
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
import subprocess | |
script = 'display notification "Finished" with title "Job Finished" sound name "Tritone"' | |
p = subprocess.Popen(["osascript"], stdin=subprocess.PIPE) | |
p.stdin.write(script) | |
p.stdin.close() | |
p.wait() |
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
<?php | |
class GIFReader | |
{ | |
const TRAILER = 0x3b; | |
const IMAGE_INTRODUCER = 0x2c; | |
const EXTENSION_INTRODUCER = 0x21; | |
const GRAPHIC_CONTROL_LABEL = 0xf9; |
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 com.github.tototoshi.gifplayer | |
import scala.scalajs.js | |
import js.annotation.JSExport | |
import org.scalajs.dom | |
@JSExport | |
object GIFPlayer extends js.JSApp { | |
def main(): Unit = { |
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
example=# CREATE TABLE tstest (ts1 timestamp, ts2 timestamp with time zone); | |
CREATE TABLE | |
example=# \d tstest; | |
Table "public.tstest" | |
Column | Type | Modifiers | |
--------+-----------------------------+----------- | |
ts1 | timestamp without time zone | | |
ts2 | timestamp with time zone | | |
example=# INSERT INTO tstest VALUES (current_timestamp, current_timestamp); |
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
case class User(id: Int, name: String) | |
object Test { | |
import scalacache._ | |
import memoization._ | |
import redis._ | |
implicit val scalaCache = ScalaCache(RedisCache("localhost", 6379)) |
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
import scala.concurrent.Future | |
// def successful[T](result: T): Future[T] を使った場合 | |
// result を評価する時点でブロックされるので | |
// a b c の順に表示される | |
println("a") | |
val f1 = Future.successful { Thread.sleep(1000); println("b") } | |
println("c") | |
// def apply[T](body: ⇒ T)(implicit execctx: ExecutionContext): Future[T] |
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
import java.util.List | |
import twitter4j.Query | |
import twitter4j.QueryResult | |
import twitter4j.Tweet | |
import twitter4j.Twitter | |
import twitter4j.TwitterFactory | |
import scala.collection.JavaConversions._ | |
object SimpleTwitterSearchApp { | |
def search(word: String = "#rpscala") { |
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
(ns sample | |
(:import (twitter4j Query | |
QueryResult | |
Tweet | |
TwitterFactory))) | |
(def twitter-api (.. (TwitterFactory.) getInstance)) | |
(defn make-query [word] |
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
import scala.collection.JavaConversions._ | |
import java.util.List | |
import twitter4j.{TwitterFactory, Twitter, Tweet, QueryResult, Query} | |
object SimpleTwitterSearchApp { | |
def search(word: String = "#rpscala"): List[Tweet] = { | |
val query = new Query | |
query.setQuery(word) | |
val twitter = new TwitterFactory().getInstance() |
OlderNewer