Discover gists
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
_,,....,,_ _人人人人人人人人人人人人人人人_ | |
-''":::::::::::::`''> ゆっくりした結果がこれだよ!!! < | |
ヽ::::::::::::::::::::: ̄^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^ ̄ | |
|::::::;ノ´ ̄\:::::::::::\_,. -‐ァ __ _____ ______ | |
|::::ノ ヽ、ヽr-r'"´ (.__ ,´ _,, '-´ ̄ ̄`-ゝ 、_ イ、 | |
_,.!イ_ _,.ヘーァ'二ハ二ヽ、へ,_7 'r ´ ヽ、ン、 | |
::::::rー''7コ-‐'"´ ; ', `ヽ/`7 ,'==─- -─==', i | |
r-'ァ'"´/ /! ハ ハ ! iヾ_ノ i イ iゝ、イ人レ/_ルヽイ i | | |
!イ´ ,' | /__,.!/ V 、!__ハ ,' ,ゝ レリイi (ヒ_] ヒ_ン ).| .|、i .|| | |
`! !/レi' (ヒ_] ヒ_ン レ'i ノ !Y!"" ,___, "" 「 !ノ i | |
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
def explain! | |
puts 'Want to embed this Gist?' | |
puts 'Use this: <script src="http://gist.github.com/2059.js"></script>' | |
end | |
explain! |
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
class String | |
def strimwidth(width) | |
self.split(//)[0...width].join | |
end | |
end | |
#see also http://www.ruby-lang.org/ja/man/html/Array.html#self.5bstart.2e.2eend.5d |
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
+-+-+-+-+-+-+-----+-+ +-+-----------+-+-+ | |
| |.| |.| |. . .|.'.|.'. .'. .'. .|.|.| | |
+---+'+-+'+-+ +-+ | |'+'+---+ +'+'| | |
|. .'. . . .'. . .|. .|.|.|.|. .|. .|. .| | |
|'+-+'+ +---+ | | +-+-+--'----+ + | |
|.| |.|.| |. . .|. .|.| |.'. .'. .'. .| | |
+-+-+-+ +---+-+-+'| | | | | +---+---+---+ | |
|. . .|.|. . .| |.|.|.|.| |.| |. .|. .| | |
| |'| | | +-+ | | | | +-+--'+ | | |
|. . .'.'. . .| |.| |.|.| |.| |.'. .'. .| |
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
///////////////////////////////////////// | |
// Sample for Embedding C++ into R // | |
///////////////////////////////////////// | |
// | |
// I keep forgetting how to do this so here's an example. | |
// If you're willing to use R's most primitive FFI interface, | |
// things are incredibly simple and easy to get going. | |
// -Brendan O'Connor (brenocon@gmail.com) | |
// | |
// Compile with, e.g. on mac: |
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
_,,....,,_ _人人人人人人人人人人人人人人人_ | |
-''":::::::::::::`''> ゆっくりしていってね!!! < | |
ヽ::::::::::::::::::::: ̄^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^ ̄ | |
|::::::;ノ´ ̄\:::::::::::\_,. -‐ァ __ _____ ______ | |
|::::ノ ヽ、ヽr-r'"´ (.__ ,´ _,, '-´ ̄ ̄`-ゝ 、_ イ、 | |
_,.!イ_ _,.ヘーァ'二ハ二ヽ、へ,_7 'r ´ ヽ、ン、 | |
::::::rー''7コ-‐'"´ ; ', `ヽ/`7 ,'==─- -─==', i | |
r-'ァ'"´/ /! ハ ハ ! iヾ_ノ i イ iゝ、イ人レ/_ルヽイ i | | |
!イ´ ,' | /__,.!/ V 、!__ハ ,' ,ゝ レリイi (ヒ_] ヒ_ン ).| .|、i .|| | |
`! !/レi' (ヒ_] ヒ_ン レ'i ノ !Y!"" ,___, "" 「 !ノ i | |
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
class Admin::JobsController < ApplicationController | |
layout 'admin' | |
moderation_fu :model => Job | |
before_filter :admin_required | |
def index | |
@jobs = Job.paginate(:page => params[:page]) | |
end | |
def show |
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
class Admin::JobsController < ApplicationController | |
layout 'admin' | |
moderation_fu :model => Job | |
before_filter :admin_required | |
def index | |
@jobs = Job.paginate(:page => params[:page]) | |
end | |
def show |
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
before :deploy, "solr:stop" | |
after :deploy, "solr:start" | |
namespace :solr do | |
task :stop, :roles => :app do | |
run "#{sudo} monit stop solr" | |
end | |
task :start, :roles => :app do | |
run "#{sudo} monit start solr" |
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
get '/:post_id' do | |
last_modification_of_post = Blog::Post[ params[:post_id], {:only => ['id', 'updated_on']} ] | |
last_modified( last_modification_of_post.updated_on ) if last_modification_of_post | |
@post = Blog::Post[ params[:post_id] ] | |
throw :halt, [404, erb(not_found) ] unless @post | |
erb :post | |
end |