Skip to content

Instantly share code, notes, and snippets.

View daiksy's full-sized avatar

KASUYA, Daisuke daiksy

View GitHub Profile
@daiksy
daiksy / mackerel_jvm8_heap.py
Created October 8, 2015 02:46 — forked from tksmd/mackerel_jvm8_heap.py
Mackerel Jolokia JVM8 sample
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import urllib2
import json
import os
import tempfile
import codecs
from optparse import OptionParser
@daiksy
daiksy / kadokawa.scala
Last active August 29, 2015 14:22
カドカワ
import scala.util.Random
val r = new Random()
r.shuffle(List("カ", "ド" ,"カ" ,"ワ", "ン", "ゴ")).take(4).mkString
@daiksy
daiksy / CodingGameEasy3.scala
Last active August 29, 2015 14:07
CodingGame Puzzle - Kirk's Quest - The Descent
import math._
import scala.util._
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
object Player {
def main(args: Array[String]) {
@daiksy
daiksy / CodingGameTraining.scala
Created October 4, 2014 03:39
CodingGame Training
import math._
import scala.util._
/**
* The code below will read all the game information for you.
* On each game turn, information will be available on the standard input, you will be sent:
* -> the total number of visible enemies
* -> for each enemy, its name and distance from you
* The system will wait for you to write an enemy name on the standard output.
* Once you have designated a target:
@daiksy
daiksy / hoge.vb
Created May 8, 2014 12:47
https://twitter.com/chomado/status/464381263978041345 の指摘に従って実装してみた。
Dim い As Integer
For い = 0 To 5
'ループ内の処理
Next い
Dim ろ As Integer
For ろ = 0 To 5
'ループ内の処理
def qSort[T <% Ordered[T]](data: List[T]): List[T] = {
data match {
case Nil => data
case x::xs => {
qSort(xs.filter(_ < x)) ++ List(x) ++ qSort(xs.filter(x <= _))
}
}
}
qSort(List(2, 44, 5, 3, 1, 3, 9, 56, 7, 8, 4, 111, 0, 3, 4)) foreach println
def bubbleSort(arr: Array[Int]): Array[Int] = {
for(i <- 0 until arr.length - 1; j <- 0 until arr.length - 1 - i) {
if (arr(j) > arr (j + 1)) {
val temp = arr(j)
arr(j) = arr(j + 1)
arr(j + 1) = temp
}
}
arr
}
@daiksy
daiksy / gist:5972013
Last active December 19, 2015 14:49
ScalaでRuntimeExceptinの派生
class MyException(message: String, cause: Throwable) extends RuntimeException(message, cause) {
def this() = this(null, null)
def this(message: String) = this(message, null)
def this(cause: Throwable) = this(null, cause)
}
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "centos64_64"
@daiksy
daiksy / gist:5363696
Last active December 16, 2015 02:39
質問にお答えする

step1

パラメータを受け取るコントローラを作る

object Application extends Controller {
  def parameterExample(parameter: String) = Action  {
    Ok(views.html.index(parameter))
  }
}