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
# -*- coding: utf-8 -*- | |
require "tempfile" | |
desc "scaffoldで生成されたコントローラーからrespond_toブロックを消す" | |
namespace :my do | |
task :rm_respond_to do | |
Dir::glob("app/controllers/*_*.rb") do |ctrl| | |
if !(File::basename(ctrl) =~ /application/) | |
temp = Tempfile::new("tmp",Dir::pwd) | |
open(ctrl) do |f| | |
text = f.read |
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
#! /usr/bin/env perl | |
use warnings; | |
use strict; | |
use 5.010; | |
sub prompt{ | |
do{ | |
my $hand; | |
say "グー[g], チョキ[c], パー[p]"; | |
print "入力してください:"; |
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 5.010; | |
use strict; | |
use warnings; | |
use autodie; | |
use AnyEvent; | |
open my $fh, '< hoge.txt'; | |
my $cv = AnyEvent->condvar(); | |
my $reader = AnyEvent->io( | |
fh => $fh, |
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
# -*- coding: utf-8 -*- | |
require 'oauth2' | |
require 'sinatra' | |
require 'httparty' | |
require 'yaml' | |
enable :sessions | |
# コンシューマキーとシークレットを設定 | |
configure do | |
config = YAML.load_file("setting.yml") #yaml形式で設定を書いた |
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
== form_tag '/submit', :id => 'entry' do | |
== field_set_tag do | |
.fields | |
== label_tag :title, :class => 'diary-title' | |
== text_field_tag :title, :name => 'title', :size => "40" | |
.fields | |
== label_tag :body, :class => 'diary-body' | |
== text_area_tag :body, :rows => "30", :cols => "50" | |
== hidden_field_tag :name => 'photo1' | |
== hidden_field_tag :name => 'photo2' |
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
;;; Time-stamp: <2011-07-22 18:05:48 namai> | |
;;; | |
(add-to-list 'load-path "~/.emacs.d/elisp/") | |
;; auto-install | |
(setq auto-install-directory "~/.emacs.d/auto-install/") | |
(add-to-list 'load-path auto-install-directory) | |
(add-to-list 'load-path (expand-file-name "~/.emacs.d/auto-install")) | |
;;(add-to-list 'custom-theme-load-path "~/.emacs.d/elisp/") | |
(require 'auto-install) |
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
;;; Time-stamp: <2011-09-19 19:59:30 namai> | |
;;ファイル保存時にコンパイル | |
(add-hook 'after-save-hook | |
(function (lambda () | |
(if (string= (expand-file-name "~/.emacs") | |
(buffer-file-name)) | |
(save-excursion | |
(byte-compile-file (expand-file-name "~/.emacs"))))))) | |
(add-to-list 'load-path "~/.emacs.d/elisp/") |
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
(defun anything-filelist+ () | |
"Preconfigured `anything' to open files/buffers/bookmarks instantly. | |
This is a replacement for `anything-for-files'. | |
See `anything-c-filelist-file-name' docstring for usage." | |
(interactive) | |
(anything-other-buffer | |
'(anything-c-source-ffap-line | |
anything-c-source-ffap-guesser | |
anything-c-source-buffers+ |
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 Twitter | |
module Request | |
def get | |
puts "Hello Twitter.user!!" | |
end | |
end | |
end |
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
# !/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
# grep 関数の普通の使い方1 | |
# 文字列の中にpが含まれている単語のフィルタリング | |
# grep EXP, LIST という構文 | |
my @list = qw(perl ruby python php java c++); |
OlderNewer