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
# 参考 | |
# * https://developers.google.com/google-apps/calendar/quickstart/ruby | |
# * https://github.com/google/google-api-ruby-client/blob/master/samples/cli/lib/samples/analytics.rb | |
# * https://gist.github.com/rakuishi/5010ee819260cdd32a15 | |
# $ gem install google-api-client | |
require 'googleauth' | |
require 'googleauth/stores/file_token_store' | |
require 'google/apis/analytics_v3' | |
require 'fileutils' |
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
git init | |
git remote add origin [email protected]:username/repo.git | |
git fetch | |
git branch master origin/master | |
git reset --mixed FETCH_HEAD | |
git branch -vv |
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/sh | |
PROJECT=sample | |
DATABASE=sample | |
case $1 in | |
"start") | |
docker rm -f ${PROJECT} | |
docker build -t ${PROJECT} . | |
docker rmi $(docker images | awk '/^<none>/ { print $3 }') |
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/rails s | |
./bin/bundle install --path vendor/bundle | |
./bin/bundle exec rails g rspec:install | |
./bin/bundle exec rspec | |
./bin/rails runner -e development SampleWorker.task | |
curl -H "X-Access-Token: eyJ..." http://localhost:3000/api/v1/goods | |
curl -H "X-Access-Token: eyJ..." -X POST -d "" http://localhost:3000/api/v1/goods/1 | |
curl -H "X-Access-Token: eyJ..." -X POST -d count=1207 http://localhost:3000/api/v1/goods/1 |
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
php -S localhost:8080 -t public_html/ |
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
require 'sqlite3' | |
require 'fileutils' | |
require 'uri' | |
require 'net/http' | |
require 'json' | |
DIR = 'app/src/main/assets' | |
FILENAME = 'earthview.db' | |
def get_path(dir, filename) |
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
<?php | |
$dir = './content/archives/'; | |
$filenames = []; | |
if ($handle = opendir($dir)) { | |
while (false !== ($filename = readdir($handle))) { | |
if ($filename != "." && $filename != ".." && strtolower(substr($filename, strrpos($filename, '.') + 1)) == 'md') { | |
$filenames[] = $filename; | |
} | |
} |
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
require 'nokogiri' | |
require 'open-uri' | |
doc = Nokogiri::HTML(open('http://www.onsen.ag')) | |
doc.xpath('//section[@id="movieList"]//div[@class="listWrap"]//ul[@class="clr"]//li').each do |node| | |
p node.xpath('h4[@class="listItem"]').inner_text | |
p node.xpath('p[@class="thumbnail listItem"]//img').attribute('src').text | |
break | |
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
$ mkdir backup | |
$ chmod 777 backup | |
$ mysql -u root | |
> USE [DATABASE_NAME]; | |
> SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('post_tag') INTO OUTFILE "/backup/post_tag.csv" FIELDS TERMINATED BY "," ENCLOSED BY "\"" LINES TERMINATED BY "\n"; |
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
$ htpasswd -cb .htpasswd username password |