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 / DtoBase.php
Last active August 29, 2015 14:03
Base Class of DTO for shared use.
<?php
/**
* class for dto-base.
*/
class DtoBase {
/** array storing propertie's names */
protected $_propeties = [];
/** array storing values */
@deadcheat
deadcheat / sidekiq
Last active August 29, 2015 14:04 — forked from akishin/sidekiq
Gitlab の起動スクリプトを Passenger で使うために Sidekiq のみにしたもの。( https://gist.github.com/akishin/6104332 )をさらにec2でのdiscourseのインストールに適合させたもの
#!/bin/bash
#
# Sidekiq
# chkconfig: 2345 82 55
# processname: sidekiq
# description: Runs sidekiq
# Include RedHat function library
. /etc/rc.d/init.d/functions
@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
{
@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 = "";
/**
* The event handler mappings for the application.
*
* @var array
*/
protected $listen = [
'illuminate.query' => [
'App\Handlers\Events\QueryLogTracker',
],
];
@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]),
@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 / 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 / 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 / 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;