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
params = {'key'=>'apikey', 'code'=>'01234', 'start'=>0, 'rows'=>0} | |
params.map{|k,v| "#{k}=#{v}"}.join('&') | |
# => "key=apikey&code=01234&start=0&rows=0" |
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
params = {key:'apikey', code:'01234', start:0, rows:0} | |
("#{k}=#{v}" for k, v of params).join('&') | |
# => 'key=apikey&code=01234&start=0&rows=0' |
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
open /Library/Documentation/Jenkins/command-line-preferences.html |
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
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist | |
sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist |
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
<dict> | |
<key>JENKINS_HOME</key> | |
<string>/Users/Shared/Jenkins/Home</string> | |
</dict> |
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
sudo mkdir /Users/Shared/Jenkins/Home | |
sudo chown daemon /Users/Shared/Jenkins/Home | |
sudo chgrp daemon /Users/Shared/Jenkins/Home |
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
defaults write /Library/Preferences/org.jenkins-ci httpPort 18080 | |
defaults write /Library/Preferences/org.jenkins-ci ajp13Port 18009 | |
defaults write /Library/Preferences/org.jenkins-ci heapSize 128m |
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
require 'rmagick' | |
require 'aws/s3' | |
AWS::S3::Base.establish_connection!(:access_key_id=>'<YOUR_ID>', :secret_access_key=>'<YOUR_SECRET>') | |
AWS::S3::DEFAULT_HOST.replace 's3-ap-northeast-1.amazonaws.com' # if use Tokyo Region | |
img = Magick::ImageList.new('path/to/file.jpg') | |
AWS::S3::S3Object.store('filename_thumb_m.jpg', img.thumbnail(640,480).to_blob {self.quality=92}, '<bucket-name>') | |
AWS::S3::S3Object.store('filename_thumb_s.jpg', img.thumbnail(160,120).to_blob {self.quality=92}, '<bucket-name>') | |
# 1時間したらアクセス出来ないURLをゲット | |
puts AWS::S3::S3Object.url_for('filename_thumb_m.jpg', '<bucket-name>', :expires_in=>3600) |
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
a = [1,2,3,4,5] | |
n for n in a when n!=3 |
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
# gem install awesome_print | |
require 'ap' | |
h = {:a=>1, :b=>2, :c=>[1,2,3], :d=>'foobar', :e=>{:x=>100,:y=>200}} | |
ap h | |
# => | |
{ | |
:a => 1, | |
:b => 2, | |
:c => [ |