Skip to content

Instantly share code, notes, and snippets.

View deadcheat's full-sized avatar
⛱️
deadcheat is #allelite now

deadcheat deadcheat

⛱️
deadcheat is #allelite now
  • Tokyo
View GitHub Profile
@deadcheat
deadcheat / optionalstring.go
Created June 15, 2016 14:41
sql.NullStringをjsonにきれいに入れたり出したりするための何か
// localtype パッケージ
// アプリケーションローカルの型はここに格納したい
package localtype
import (
"database/sql"
"database/sql/driver"
"encoding/json"
)
@deadcheat
deadcheat / main.go
Created June 3, 2016 00:41
the・稚拙・NullStringエンコード
package main
import (
"database/sql"
"encoding/json"
"os"
"database/sql/driver"
_ "github.com/go-sql-driver/mysql"
log "github.com/Sirupsen/logrus"
"fmt"
@deadcheat
deadcheat / tweet-sample
Last active May 10, 2016 15:56
Example receive a callback from twitter-oauth, and tweet strings given by args.
extern crate twitter_api as twitter;
extern crate oauth_client as oauth;
extern crate aurelius;
extern crate iron;
extern crate urlencoded;
use aurelius::browser;
use iron::prelude::*;
use oauth::Token;
use std::env;
@deadcheat
deadcheat / 0_reuse_code.js
Created December 28, 2015 06:59
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@deadcheat
deadcheat / dirou.exs
Created October 28, 2015 11:20
痔ろう
defmodule Dirou do
def try(hp, _) when hp <= 0 do
IO.puts "痔ろうの危機!!\(^o^)/"
IO.puts "もうやめて!おしりのライフはとっくに0よ!!"
end
def try(hp, meals) do
key = Random.sample(1..4)
meal = meals[key]
damage = case key do
@deadcheat
deadcheat / dirou.go
Created October 1, 2015 11:38
痔ろう.go
package main
import (
"fmt"
"math/rand"
)
func main() {
foods := []string{"🍣", "🍖", "北極ラーメン", "ラーメン二郎"}
hp := 200
@deadcheat
deadcheat / prog.erl
Last active December 9, 2015 06:58
自分向けErlangテンプレート(IdeoneとかCodeIQ用) ref: http://qiita.com/yodatomato/items/e57f8e3f5210643fbf5c
-module(prog).
-author("yodatomato").
-export([main/0]).
%% 主処理
main() ->
Num = readnumber(),
List = makelist(Num),
io:fwrite("N:~b\n", [Num]),
io:fwrite("List:~w\n", [List]),
/**
* The event handler mappings for the application.
*
* @var array
*/
protected $listen = [
'illuminate.query' => [
'App\Handlers\Events\QueryLogTracker',
],
];
@deadcheat
deadcheat / ConfigBase.php
Last active August 29, 2015 14:13
I'm so tired to type 'Config::get()' ref: http://qiita.com/yodatomato/items/e0ce88d1dac00bcbcf24
<?php
/**
* コンフィグファイルのラップオブジェクト
* 継承して$_confignameをコンフィグファイル名の値を入れると
* よい
*/
class ConfigBase {
protected $_configname = "";
@deadcheat
deadcheat / background_jobs
Last active August 29, 2015 14:04
GitLabでのsidekiq用起動スクリプトをdiscourseに適合させたもの
#!/bin/bash
cd $(dirname $0)/..
app_root=$(pwd)
sidekiq_pidfile="$app_root/tmp/pids/sidekiq.pid"
sidekiq_logfile="$app_root/log/sidekiq.log"
gitlab_ci_user=$(ls -l config.ru | awk '{print $3}')
function stop
{