Skip to content

Instantly share code, notes, and snippets.

View hrysd's full-sized avatar
🤔
hoi

Hiroshi Yoshida hrysd

🤔
hoi
View GitHub Profile
@hrysd
hrysd / README.md
Last active August 29, 2015 14:08
Ansible module. Send notifcation to Idobata

Usage

$ wget https://gist.githubusercontent.com/hrysd/d10269472a2a62b6fb18/raw/c11247e6ea96305d68f3c1854912c216760c2d69/idobata
$ mv idobata /path/to/playbook/library

Refs

#! /bin/sh
### BEGIN INIT INFO
# Provides: skeleton
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
@hrysd
hrysd / 4.1.diff
Created April 12, 2014 15:51
config の diff。 `rails new hoge`
diff --git a/config/database.yml b/config/database.yml
index 51a4dd4..1c1a37c 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -3,23 +3,23 @@
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
-development:
+#
sed -e '/childprocess\|erubis\|log4r\|net-scp/s/~>/>=/' \
-e '/net-ssh/s:, "< 2.8.0"::' \
@hrysd
hrysd / child_record.md
Last active December 23, 2015 19:19
ember-data(beta2) で async: true な child record を create

DS.ManyArray#createRecordcreateRecord をもっていてそのままつくれる

DS.PromiseArray はもってなくて作れないので、ManyArray にしてあげてから作るのがベストの様子

ManyArray#createRecord 内部で owner, store, type を用意してくれる

App.Post = DS.Model.extend({
  comments: DS.hasMany('comment', {async: true})
});
language: node_js
node_js:
- "0.10"
before_install:
- npm install -g grunt-cli bower
- npm install
- grunt
- npm test
class Account < ActiveRecord::Base
  with_options :dependent => :destroy do |assoc|
    assoc.has_many :customers
    assoc.has_many :products
    assoc.has_many :invoices
    assoc.has_many :expenses
  end
end
@hrysd
hrysd / prompt.sh
Last active December 15, 2015 02:09
export PS1='\[\033[1;34m\][\w]\[\033[0m\]\[\033[1;32m\]$(__git_ps1)\[\033[00m\]\[\033[1;36m\]>\[\033[0m\] '
@hrysd
hrysd / memo.md
Last active December 13, 2015 21:29
これ知らなかった。
@hoge = Hoge.new(params[:hoge]) do |h|
  h.user = current_user
end

Hoge.create(params[:hoge]) do |h|
  h.user = current_user
end

User.create([{ name: 'hoge'}, { name: 'huga' }, { name: 'piyo' }]) do |u|
@hrysd
hrysd / nginx.conf
Created January 16, 2013 04:41
nginx
# Mainモジュール
# ワーカープロセスを実行するユーザーの指定
user www-data;
# ワーカープロセスの数。さくらのVPSのコア数にあわせた。
worker_processes 2;
# 全体でのエラーログの詳細度の指定。
error_log logs/error.log notice;