Skip to content

Instantly share code, notes, and snippets.

# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@timakin
timakin / interfacemap.go
Created May 11, 2016 15:55
map[string]interface{}{}
package main
import (
"fmt"
)
func main() {
test := make(map[string]interface{})
test["test"] = "yoyo"
tetete(test)
@timakin
timakin / gist:6b5147ad2c1af80715d5
Created October 16, 2015 13:43
オレオレ証明書
$ openssl genrsa 2048 > server.key
$ openssl req -new -key server.key > server.csr
$ openssl x509 -days 3650 -req -signkey server.key < server.csr > server.crt
そもそも サービスってなんやねん
- デーモンです
- デーモンって?
- バックグラウンドプロセスとして動作するプログラムを意味する。 ユーザーが直接対話的に制御するプログラムではない。
- へー。
- これをいろいろ扱えるのがdaemontoolsか。
@timakin
timakin / perform.rb
Last active August 29, 2015 14:24
Comparison of Performance: Instance and Hash, optionally with simple array.
class NewsFeed
attr_accessor :title, :memo
def initialize(title, memo)
@title = title
@memo = memo
end
def title
@title
end
@timakin
timakin / gist:34255f56dd5595cee421
Last active October 22, 2022 07:08
Gitのsubtreeについてのまとめ

前提

  • まとめた目的
    • プロジェクトのルートディレクトリにsubtree先を展開できないかなーという話を検証したので、その記録
      subtreedDir/
        /A
        /B
      とかがあるとき、それをsubtreeとして呼び出す、childプロジェクトがあるとする。このとき、
    

child/

@timakin
timakin / .DS_Store
Last active August 29, 2015 14:21
timakin_board
@timakin
timakin / gist:1d4c781b1e508419f790
Last active August 29, 2015 14:19
PromiseTest
var request = require('request');
var gurl = 'http://google.com'
var yurl = 'http://yahoo.co.jp'
var testreq = function(url) {
return new Promise(function(resolve, reject) {
request(url, function (error, response, body) {
if (error) {
reject(err);
} else {
resolve(body);
@timakin
timakin / バイナリサーチ
Created March 4, 2015 09:36
文系が学ぶコンピューターサイエンス╭( ・ㅂ・)و ̑̑:第8回【リニアサーチ、バイナリサーチ】 ref: http://qiita.com/timakin/items/f4121db6f7dadb0472c2
// バイナリサーチ(2分探索)
// 基準点の前後を分けて探ることで、計算量をO(logN)に抑えることができる。
// バイナリサーチはあたいの大小を元に捜索するため、対象がソート済みの配列でなくてはならない。
binarySearch: function(data, target) {
var left = 0,
right = data.length - 1,
middle;
while(left <= right) {
// 基準点を毎回更新する。
@timakin
timakin / file0.js
Created February 22, 2015 07:33
文系が学ぶコンピューターサイエンス╭( ・ㅂ・)و ̑̑:第7回【2分挿入ソート】 ref: http://qiita.com/timakin/items/211bf914d7a137061d2f
// 2分挿入ソート
binaryInsertionSort: function(data) {
var left, right, mid, temp;
for (var sorted = 1; sorted < data.length; sorted++) {
var insert = data[sorted];
// ここからバイナリサーチ
    // どこに値を挿入するべきかを探す
left = 0;