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
# 仮に RPG 的なソーシャルゲームだとして。。。 | |
# | |
# == 前提 | |
# | |
# * 武器やボスは、ユーザーとの中間テーブルとマスターデータが別テーブルになってます。 | |
# * User <>--- Weapon ---<> WeaponMaster 的な。 | |
# * User は同じ種類の (master の id が同じ) 武器をいっぱい持てます。 | |
# * User は同じ種類のボスはひとつしか持てないです。 | |
# | |
# == やりたい事 |
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
class Hoge | |
attr_accessor :a | |
attr_accessor :b | |
def initialize(initialize_options = {}) | |
defaults = { | |
:a => "aaaa", | |
:b => "bbbb" | |
} | |
defaults.merge!(initialize_options) |
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 HogeController extend ParentController { | |
public function fuga() { | |
$filtered =SomeUtil::do_something($_GET["foo"]); | |
RefactoredUtil::refactored_func($filtered); | |
} | |
} | |
class RefactoredUtil { | |
public static function refactored_func($ary) { |
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 myPackage.* | |
class Main | |
{ | |
Type.resolveClass("myPackage.Hoge"); // return null | |
var instance:Hoge = new Hoge(); // OK | |
Type.resolveClass("myPackage.Hoge"); // return [class Hoge] | |
} |
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
TOKEN="your token via https://api.slack.com/web" | |
CHANNEL="slack channel to post" | |
MUSIC=`osascript <<'END' | |
tell application "iTunes" | |
set trackName to name of current track | |
set trackArtist to artist of current track | |
return trackName & " / " & trackArtist | |
end tell | |
END | |
` |
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
source 'https://rubygems.org' | |
gem 'slim' |
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 'rake' | |
Table = Struct.new(:name, :comment, :columns, :indexes) | |
Column = Struct.new(:name, :type, :not_null, :default, :primary_key, :comment) | |
Index = Struct.new(:name, :columns, :primary, :unique) | |
def get_schema_info(klass) | |
table = Table.new | |
table.name = klass.table_name | |
table.columns = [] |
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 'yaml' | |
# とりあえず bundle list の結果から、gem の名前だけを取得して配列に突っ込んでみます | |
gems = (`bundle list | awk '{print $2}'`).split("\n") | |
# 先頭2行は bundler の出力なので無視します | |
2.times{ gems.shift } | |
gems.each do |gem| | |
puts gem | |
# 具体的な情報は gem spec GEMFILE で取得します。結果は yaml でくるので、パースしてやります。 |
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
function myFunction() { | |
// 入力した名前を表示するプログラムです。 | |
var name = Browser.inputBox("名前を入れてください"); | |
var output_string = "ようこそ" + name + "さん"; | |
Browser.msgBox(output_string); | |
} |
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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<title>page.js の動き方</title> | |
<meta charset="UTF-8"> | |
</head> | |
<body> | |
<nav> | |
<ul> | |
<li><a href="/">メイン</a></li> |
OlderNewer