Skip to content

Instantly share code, notes, and snippets.

@tomoyukiinoue
tomoyukiinoue / gist:7968556
Created December 15, 2013 03:37
Rails4 で気合を入れるプラグイン acts_as_kiai を作ってみた

Rails4 で気合を入れるプラグイン acts_as_kiai を作ってみた

Rails4でActivityRecordを拡張し、気合を入れてくれるプラグイン acts_as_kiai を開発したのでその時のメモです。

基本的な流れ

  1. 仕様を決める
  2. 開発を始める
  3. コアを書く
@ledsun
ledsun / toWareki.js
Created July 23, 2012 04:51
JavaScript 西暦→和暦の変換処理
function toWareki(year,month,day)
{
var wareki = "";
year = Number (year);
if (year == 1868)
{
/* 9月8日から明治元年 */
/* 誕生日がここの人はいないだろうから細かくは気にしない */
wareki = '明治元年';
}
@melborne
melborne / Plugins.textile
Created May 9, 2012 11:54
Translation of Jekyll Plugins

https://github.com/mojombo/jekyll/wiki/Plugins

Jekyllプラグインシステムのフックは、あなたのサイト向けに特化したコンテンツの生成を可能にします。Jekyllのソースを修正することなく、あなたのサイト用のコードを実行できます。

The Jekyll plugin system hooks allow you to create custom generated content specific to your site. You can run custom code for your site without having to modify the Jekyll source itself.

プラグインのインストール

h2. Installing a plugin

@nlevchuk
nlevchuk / unicorn
Created March 27, 2012 09:54 — forked from vdv/unicorn
unicorn init.d script with rvm on ubuntu 11.04
#!/bin/bash
### BEGIN INIT INFO
# Provides: APPLICATION
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the APPLICATION unicorns at boot
# Description: Enable APPLICATION at boot time.
### END INIT INFO
@beanieboi
beanieboi / mongoid version diff
Created January 26, 2011 13:13
shows the diff between two versions when you use Mongoid::Versioning
def compare_to(version)
reject_fields = ["_id", "updated_at", "version"]
diff_array = self.versions[version-1].attributes.to_hash.to_a - self.attributes.to_hash.to_a
diff_array.delete_if {|f| reject_fields.include?(f.first) }
Hash[diff_array]
end