Skip to content

Instantly share code, notes, and snippets.

View hara-y-u's full-sized avatar
🏠
Working from home

hara_yu hara-y-u

🏠
Working from home
View GitHub Profile
@hara-y-u
hara-y-u / week_index_in_month.rb
Last active July 10, 2024 15:22
Ruby Script to find week index in month. / 日付がその月の第何週目かを調べるRuby Script
# If you look at each month on calendar, you will notice 1-7days are on the first week and same for the rest.
# Therefore, the following formula holds.
# ISO8601 is not supported
(date.day - 1) / 7 + 1
@hara-y-u
hara-y-u / sequential_id.rb
Last active June 8, 2024 07:53
Scoped Sequential ID Concern for Rails Models
# 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
@hara-y-u
hara-y-u / 0_reuse_code.js
Created November 20, 2015 15:31
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
@hara-y-u
hara-y-u / shinchoku.coffee
Last active August 29, 2015 13:56
進捗どうですか? on Hubot
# 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']
@hara-y-u
hara-y-u / find-outdated-docs.sh
Last active January 2, 2016 17:19
find out dated files for enja-oss/stylus
#!/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
@hara-y-u
hara-y-u / bifs.diff
Last active January 2, 2016 16:29
enja-oss/stylus out dated files(2013-1-9)
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)
@hara-y-u
hara-y-u / Gemfile
Last active December 31, 2015 20:39
test for rails-sass-source-maps
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'
@hara-y-u
hara-y-u / Vagrantfile
Last active December 27, 2015 11:09
Conf file for hosting yukihr.github.io/fjord_intern on Debian wheezy on VirtualBox with nginx.
# -*- 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"
カレーのレシピ
誰でもできる、美味しいカレーの作り方です。旦那も息子もこのカレーが大好物。
ポイントは玉ねぎと人参はミキサーで細かくしてしまうところ。逆にコクのある美味しいカレーになります。
レシピの作者
山田サチ子さん
材料 ( 8皿分 )
@hara-y-u
hara-y-u / subscribeFeedlyBookmarklet.js
Created September 12, 2013 21:24
SubscribeFeedly Bookmarklet Source
// Compile with:
// http://subsimple.com/bookmarklets/jsbuilder.htm
(function(w) {
var r, i, u, t,
l = document.getElementsByTagName('link'),
ll = l.length;
for(i=0; i<ll; i++) {
if(l[i].getAttribute('rel') === 'alternate'