Skip to content

Instantly share code, notes, and snippets.

View linyows's full-sized avatar

Tomohisa Oda linyows

View GitHub Profile
@linyows
linyows / gist:3422581
Created August 22, 2012 05:41
ride on unicorn
#!/bin/sh
#
# color
#
RES_COL=60
MOVE_TO_COL="echo -en \\033[${RES_COL}G"
SETCOLOR_SUCCESS="echo -en \\033[1;32m"
SETCOLOR_FAILURE="echo -en \\033[1;31m"
SETCOLOR_WARNING="echo -en \\033[1;33m"
@linyows
linyows / colorize.pl
Created June 16, 2012 05:22 — forked from Cside/colorize.pl
colorize keywords of logs.
#!/usr/bin/env perl
=head1 Examples
$ tail -f access_log | perl colorize.pl
$ plackup app.psgi 2>&1 | perl colorize.pl
=cut
use strict;
@linyows
linyows / gist:2908423
Created June 11, 2012 03:48
javascript hash merge
var a = {aaa: 1, bbb: 2, ccc: 3};
var b = {ddd: 4, eee: 5};
var Hash = function(hash){
this.hash = hash;
};
Hash.prototype.merge = function(target) {
for (var i in target) {
if (typeof target[i] === 'function') { continue; }
if (typeof target[i] === 'object') { continue; }
#!/bin/sh
ID=$1
curl http://pastebin.com/Kc9ng18h | grep $ID
curl http://pastebin.com/vCMndK2L | grep $ID
curl http://pastebin.com/JdQkuYwG | grep $ID
curl http://pastebin.com/fw43srjY | grep $ID
curl http://pastebin.com/jv4LBjPX | grep $ID

aaa

111

  • aaaaa
alert('aaa');
alert('hello');
module ActionView
module Helpers
class DateTimeSelector
# Override
# クレジットカード用に年を2桁で表示する "use_short_year" オプションを追加した
def select_year
if !@datetime || @datetime == 0
val = '1'
middle_year = Date.today.year
else
module Mongoid
module MultiParameterAttributes
protected
# Override mongoid / lib / mongoid / multi_parameter_attributes.rb
def instantiate_object(field, values_with_empty_parameters)
return nil if values_with_empty_parameters.all? { |v| v.nil? } || !field
values = values_with_empty_parameters.collect { |v| v.nil? ? 1 : v }
klass = field.type
if klass == DateTime || klass == Date || klass == Time
echo "[Oh My Zsh] Would you like to check for updates?"
echo "Type Y to update oh-my-zsh: \c"
read line
if [ "$line" = Y ] || [ "$line" = y ]
then
_upgrade_zsh
fi
$ ruby -pe 'gsub(/^.+;| .+$/,"")' ~/.zsh-history | sort | uniq -c | sort -nr | head -30
@linyows
linyows / git_tag
Created March 22, 2012 06:36
増えすぎたgitのtagを削除するスクリプト
#!/bin/zsh
case "$1" in
test)
TYPE=$1
;;
clean)
TYPE=$1
;;
*)