This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "date" | |
# Days from day one to first saturday are result in index 1 | |
def week_index_in_month(date) | |
first_day_of_month = Date.new(date.year, date.month, 1) | |
((date.day + first_day_of_month.wday) / 7.0).ceil | |
end | |
# Days from day one to seven are result in index 1 | |
def week_index_in_month(date) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Commentable | |
extend ActiveSupport::Concern | |
included do | |
has_many :comments | |
define_model_callbacks :comment_update, only: :after | |
end | |
end | |
class Post |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# This module adds single scoped sequential id on AR model. | |
# In your model, include this module like: | |
# include SequentialId[:number, scope: :user_id] | |
module SequentialId | |
def self.[](column_name, scope:) | |
options = Struct.new(:column_name, :scope) | |
Module.new do | |
extend ActiveSupport::Concern | |
include SequentialId |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put in scripts/shinchoku.coffee | |
# add "tumblr": "~0.4.0" on package.json -> "dependencies" | |
tumblr = require 'tumblr' | |
util = require 'util' | |
auth = | |
# Set these on environment variables | |
consumer_key: process.env['TUMBLR_CONSUMER_KEY'] | |
consumer_secret: process.env['TUBMLR_CONSUMER_SECRET'] | |
token: process.env['TUMBLR_TOKEN'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ORIG_DIR='./stylus_orig' | |
CLONE_TO='git clone https://github.com/LearnBoost/stylus.git' | |
LIST_DOCS='git ls-tree --name-only HEAD docs/' | |
LAST_TIME='git log -1 --pretty=format:%ct' | |
LAST_TIME_F='git log -1 --pretty=format:%cr' | |
DEV=false | |
${CLONE_TO} ${ORIG_DIR} > /dev/null 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/docs/bifs.md b/docs/bifs.md | |
index 57a6c5c..9f420ad 100644 | |
--- a/docs/bifs.md | |
+++ b/docs/bifs.md | |
@@ -19,7 +19,7 @@ Return the green component of the given `color`. | |
Return the blue component of the given `color`. | |
- red(#00c) | |
+ blue(#00c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | |
gem 'rails', '4.0.1' | |
# Use sqlite3 as the database for Active Record | |
gem 'sqlite3' | |
# Use SCSS for stylesheets | |
gem 'sass-rails', '~> 4.0.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "wheezy" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
カレーのレシピ | |
誰でもできる、美味しいカレーの作り方です。旦那も息子もこのカレーが大好物。 | |
ポイントは玉ねぎと人参はミキサーで細かくしてしまうところ。逆にコクのある美味しいカレーになります。 | |
レシピの作者 | |
山田サチ子さん | |
材料 ( 8皿分 ) |
NewerOlder