This file contains hidden or 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
| set date_tmp=%date:/=% | |
| set time_tmp=%time: =0% | |
| set yyyy=%date_tmp:~0,4% | |
| set mm=%date_tmp:~4,2% | |
| set dd=%date_tmp:~6,2% | |
| set hh=%time_tmp:~0,2% | |
| set mi=%time_tmp:~3,2% | |
| set datetime=%yyyy%-%mm%-%dd%-%hh%-%mi% |
This file contains hidden or 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
| class DefinitelyRescuedException < Exception | |
| def is_a? _klass | |
| true | |
| end | |
| def < _klass | |
| true | |
| end | |
| def > _klass | |
| false | |
| end |
This file contains hidden or 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
| class IrrescuableException < StandardError | |
| # But actually, rescued! | |
| def is_a? _klass | |
| false | |
| end | |
| end | |
| begin | |
| raise IrrescuableException | |
| rescue Exception => e |
This file contains hidden or 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/env ruby | |
| # GistID: 5428360 | |
| require 'termcolor' | |
| $KCODE = 'u' if RUBY_VERSION < '1.9' | |
| $VERBOSE = true | |
| unless Array.method_defined? :sample | |
| class Array # reopen |
This file contains hidden or 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
| {-# LANGUAGE OverloadedStrings #-} | |
| module Main where | |
| import System.Environment (getArgs) | |
| import Data.String.Utils (split) | |
| import Data.Char (digitToInt, intToDigit, isDigit) | |
| import Data.List (sort, permutations) | |
| import Data.Maybe (listToMaybe) |
This file contains hidden or 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 | |
| current_branch=$(git rev-parse --abbrev-ref HEAD) | |
| warn_branch() { | |
| echo "You can't commit on '$current_branch'!" | |
| } | |
| case $current_branch in | |
| master) warn_branch; exit 1 ;; # Of cource you can add any other important branches as you need. |
This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| # GistID: 5023809 | |
| # Tried by: Rails 3.2.12 | |
| # 控えめで (Unobtrusive) 自己中な (Selfish) Controller | |
| class UnobtrusiveJikochusController < ApplicationController | |
| def index | |
| @unobtrusive_jikochus = UnobtrusiveJikochu.all |
This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| # GistID: 5023699 | |
| # Tried by: Rails 3.2.12 | |
| # 自己中な (Selfish) Controller | |
| class JikochusController < ApplicationController | |
| def index | |
| @jikochus = Jikochu.all |
This file contains hidden or 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
| #!/usr/bin/bashdb | |
| # GistID: 4971264 | |
| ###################################################### | |
| # NOTES: | |
| # This is not just an executable shell script. | |
| # You can read this as a blog post also. | |
| # And by excuting, you'll find what I experienced. | |
| # I recommend you to execute this script step by step |
This file contains hidden or 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 | |
| # maybe useful when you want to try your committed vimscript on your vim | |
| # WARNING: as written, this script doesn't backup the destination directory | |
| GIT_PAGER=cat | |
| PAGER=cat | |
| updated_files=$(git diff --name-only master) | |
| dest_dir=$1 |