Skip to content

Instantly share code, notes, and snippets.

View yohei1126's full-sized avatar
🏠
Working from Singapore

Yohei Onishi yohei1126

🏠
Working from Singapore
View GitHub Profile
@yohei1126
yohei1126 / A_Hackers_Guide_to_the_Bay_Area
Created November 10, 2013 01:10
A_Hackers_Guide_to_the_Bay_Area.md
<h2 class="wmd-title" id="ハッカーのためのベイエリアガイド">「ハッカー」のためのベイエリア・ガイド</h2>
<p><em>(注)本ガイドは氏が書かれた<a href="http://islandofatlas.net/2013/10/04/a-hackers-guide-to-the-bay-area.html">文書</a>を大西洋平(<a href="https://twitter.com/legoboku">@legoboku</a>)が翻訳したものです。翻訳の不備については訳者にお知らせください。</em></p>
<hr>
<p>本ガイドの対象読者はサンフランシスコ・ベイエリア(特にサンフランシスコもしくはシリコンバレー)に移住したいと思っている「ハッカー」です。本ガイドは私のライフスタイルを反映したものになっています(男性、独身、技術的な仕事に専念、貯蓄、ただ健康に関心あり)。「ハッカー」にとって重要だとみなされるものにフォーカスします。</p>
<p>もっとディスカッションしたい方はこちらを参照ください(<a href="https://news.ycombinator.com/item?id=6502430">https://news.ycombinator.com/item?id=6502430</a>)。</p>
@yohei1126
yohei1126 / A_Hackers_Guide_to_the_Bay_Area
Created November 10, 2013 01:12
A_Hackers_Guide_to_the_Bay_Area.md
「ハッカー」のためのベイエリア・ガイド
-------------------
*(注)本ガイドは氏が書かれた[文書][1]を大西洋平([@legoboku][2])が翻訳したものです。翻訳の不備については訳者にお知らせください。*
----------
本ガイドの対象読者はサンフランシスコ・ベイエリア(特にサンフランシスコもしくはシリコンバレー)に移住したいと思っている「ハッカー」です。本ガイドは私のライフスタイルを反映したものになっています(男性、独身、技術的な仕事に専念、貯蓄、ただ健康に関心あり)。「ハッカー」にとって重要だとみなされるものにフォーカスします。
もっとディスカッションしたい方はこちらを参照ください([https://news.ycombinator.com/item?id=6502430][3])。
app.get('/trips', function(req, res) {
Parse.Cloud.httpRequest({
url: 'https://api.automatic.com/v1/trips',
headers: {
'Authorization': 'token xxx'
}
}).then(function(httpResponse) {
console.log(httpResponse);
res.end(httpResponse.text);
}, function(err) {
@yohei1126
yohei1126 / REST_sample
Last active August 29, 2015 14:04
How to call the Automatic REST API from Android
//URL to call REST API
final HttpPost httpPostRequest = new HttpPost("https://api.parse.com/1/functions/availableCars");
//Application ID
httpPostRequest.setHeader("X-Parse-Application-Id", "App-key");
//REST API Key
httpPostRequest.setHeader("X-Parse-REST-API-Key", "REST-API-key");
// Content type must be application/json
httpPostRequest.setHeader("Content-Type", "application/json");
try {
// You have to set valid JSON data as a form data
@yohei1126
yohei1126 / file0.txt
Created December 9, 2015 12:42
Jetty WebSocketClientをシングルスレッドで動かす ref: http://qiita.com/yohei1126@github/items/27b96f7e7fa2a6b13737
Executor executor = Executors.newFixedThreadPool(2);
WebSocketClient client = new WebSocketClient(executor);
@yohei1126
yohei1126 / file0.txt
Last active December 23, 2015 03:33
Play 2.3.xから2.4.x、Slick 2.xから3.1.xへの移行 ref: http://qiita.com/yohei1126@github/items/d60c6e498bc57c07b880
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.0")
@yohei1126
yohei1126 / file0.txt
Last active December 20, 2015 09:48
Scala コードの列挙型と DB(Slick)の整数型 / 文字列型をマッピングする ref: http://qiita.com/yohei1126@github/items/515e8463a0457059fdce
// 文字列型 にマッピングするEnum
object Color extends Enumeration {
type Color = Value
val Blue = Value("Blue")
val Red = Value("Red")
val Green = Value("Green")
}
// 整数型にマッピングするEnum
object Bar extends Enumeration {
@yohei1126
yohei1126 / file0.txt
Last active July 11, 2016 09:29
TypeScriptを使ってNode.jsとブラウザに対応したJSコード(UMD形式)を生成する ref: http://qiita.com/yohei1126@github/items/a04770e0e41c387144b6
% tree
.
├── README.md
├── index.html
├── package.json
├── src
│   ├── helloModule.ts
│   ├── index.ts
│   └── wordModule.ts
└── tsconfig.json
@yohei1126
yohei1126 / Callbacks.ts
Created May 11, 2017 01:54
Typedoc sample
export type Callback = () => void;
@yohei1126
yohei1126 / 18.1
Last active June 1, 2017 12:31
Programming in Scala 18 章 Mutable Objects ref: http://qiita.com/yohei1126@github/items/9326ab53c519690d9584
import scala.language.postfixOps
class BankAccount {
private var bal: Int = 0
def balance: Int = bal
def deposit(amount: Int) = {
require(amount > 0)
bal += amount
}
def withdraw(amount: Int): Boolean = {
if (amount > bal) false