Skip to content

Instantly share code, notes, and snippets.

View Arakaki's full-sized avatar
:octocat:
Focusing

Arakaki Arakaki

:octocat:
Focusing
  • Japan
View GitHub Profile
@Arakaki
Arakaki / hoge.php
Created October 16, 2013 06:49
phpでサマリ
<?php
//こういうのがあって
$structures = array(
array("structure_first" => "first001","structure_second" => "second001","structure_third" => "third001","count" => 1),
array("structure_first" => "first002","structure_second" => "second002","structure_third" => "third002","count" => 1),
array("structure_first" => "first003","structure_second" => "second003","structure_third" => "third003","count" => 1),
array("structure_first" => "first004","structure_second" => "second004","structure_third" => "third004","count" => 1),
);
@Arakaki
Arakaki / App.scala
Created September 18, 2013 07:23
command pattern in Scala
package com.mycode
object App {
def main(args : Array[String]) {
val receiver = new Receiver
val task = new ConcreteCommandTask(receiver)
val play = new ConcreteCommandTaskPlay(receiver)
val invoker = new Invoker
@Arakaki
Arakaki / App.scala
Created September 18, 2013 05:50
commnand.scala
package com.mycode
object App {
def main(args : Array[String]) {
val addSalt = new AddSaltCommand
val addWater = new AddWaterCommand
val makeSaltWater = new MakeSaltWaterCommand
addSalt.setBeaker(new Beaker(100,0))
addWater.setBeaker(new Beaker(0,10))
@Arakaki
Arakaki / App.scala
Created September 17, 2013 07:39
traitサンプル
package com.mycode
object App extends LoggerSupport with LoginSupport with DbSupport{
def main(args : Array[String]) {
//開始ログ
logger("START main")
//ログイン
login("arakaki")
@Arakaki
Arakaki / index.html
Created September 17, 2013 05:26
angular.jsさんぷる
<html ng-app='myApp'>
<body ng-controller='TextController'>
<p>{{someText.message}}</p>
<p ng-bind="greeting"></p>
<p>{{greeting}}</p>
<form ng-controller="StartUpController">
Starting: <input ng-change="computeNeeded()"
ng-model="funding.startingEstimate">
Recommendation: {{funding.needed}}
@Arakaki
Arakaki / main.php
Created September 16, 2013 09:01
closure of php
<?php
/**
* Created by IntelliJ IDEA.
* User: arakakiyuusuke
* Date: 2013/09/16
* Time: 17:50
* To change this template use File | Settings | File Templates.
*/
function outerFunction(){
people = %w(alice bob charile)
block = Proc.new{|name| puts name}
people.each &block
def block_sample(&block)
puts 'statu up'
block.call if block
puts 'sit down'
end
block_sample do
def default_argument_for_block
yield
end
default_argument_for_block do |val = 'Hi'|
puts val
end
def flexible_arguments_for_block
yield 1,2,3
@Arakaki
Arakaki / main.rb
Created September 9, 2013 09:28
blockの戻り値を受け取り
def with_current_time
yield Time.now
end
with_current_time do |now|
puts now.year
end