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
<?xml version="1.0" encoding="UTF-8"?> | |
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans" | |
xmlns:context="http://www.springframework.org/schema/context" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:aop="http://www.springframework.org/schema/aop" | |
xsi:schemaLocation="http://www.springframework.org/schema/beans | |
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd | |
http://www.springframework.org/schema/context | |
http://www.springframework.org/schema/context/spring-context-3.2.xsd | |
http://www.springframework.org/schema/aop |
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.par._ | |
import scala.collection.par.Scheduler.Implicits.global | |
object iterate { | |
def triangles_blitz(n: Int) = for { | |
x <- (0 until n).toPar | |
y <- 0 until x | |
} yield { y }: @unchecked | |
def triangles(n: Int) = for { |
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 -*- | |
import re | |
import sys | |
def to_camel_case(snake_str): | |
components = snake_str.split('_') | |
return components[0] + "".join(x.title() for x in components[1:]) | |
def caseClass(list): | |
for i,elem in enumerate(list[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
case class Coffees(id: Int, name: String, supId:Int, price: Double) | |
class CoffeesTable(tag: Tag) extends Table[(String, Int, Double, Int, Int)](tag, "coffees") { | |
def id = column[Int]("COF_NAME", O.PrimaryKey) | |
def name = column[String]("name") | |
def supID = column[Int]("SUP_ID") | |
def price = column[Double]("PRICE") | |
def * = (id, name, supID, price) <> (Coffees.tupled, Coffees.unapply) | |
// A reified foreign key relation that can be navigated to create a join | |
} |
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 Coffees(id: Int, name: String, supId:Option[Int], price: Option[Double]) | |
class CoffeesTable(tag: Tag) extends Table[(String, Int, Double, Int, Int)](tag, "coffees") { | |
def id = column[Int]("COF_NAME", O.PrimaryKey) | |
def name = column[String]("name") | |
def supID = column[Int]("SUP_ID") | |
def price = column[Double]("PRICE") | |
def * = (id, name, supID, price) <> (Coffees.tupled, Coffees.unapply) | |
} | |
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.cyberz.foxapi.util | |
import javax.sql.DataSource | |
import com.typesafe.config.ConfigFactory | |
import org.apache.commons.dbcp.BasicDataSource | |
import scala.slick.jdbc.JdbcBackend.Database | |
/** |
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
db { | |
driver = "com.mysql.jdbc.Driver" | |
salt = "xxxxxx" | |
max-active = 10 | |
max-idle = 5 | |
max-wait = 5000 | |
initial-size = 1 | |
validation-query = "SELECT 1" | |
test-on-borrow = true | |
time-between-evection-runs-mills = 30000 |
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.io.File | |
import com.decodified.scalassh._ | |
import com.typesafe.config.ConfigFactory | |
import org.slf4j.LoggerFactory | |
import spray.http.StatusCodes | |
import scala.io.Source | |
/** | |
* Created by Yuto Suzuki on 2014/12/24. | |
*/ | |
object SshDao { |
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 | |
import doctest | |
import MySQLdb | |
from influxdb import InfluxDBClient as ifdb | |
from datetime import datetime | |
DATA = "123456789012345678901234567890123456789012345678901234567890" | |
COUNT = 10000 * 1 |
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
def googlePlayIconUrl(appIdentifier: String): Option[String] = { | |
val googleImgTag = "div.cover-container img.cover-image" | |
def googlePlayUrl(appIdentifier: String): String = s"https://play.google.com/store/apps/details?id=$appIdentifier" | |
try { | |
val doc = Jsoup.connect(googlePlayUrl(appIdentifier)).get | |
Option(doc.select(googleImgTag).first.attr("src")) | |
} catch { | |
case e: HttpStatusException => { | |
// loggerに関しては、適当なものを定義してください。 | |
logger.error(s"GooglePlayにアクセスできません。$appIdentifier") |
OlderNewer