編號. 書名 / 進度:
- DevOps 實戰:VMware 管理員運維方法、工具及最佳實踐 / 0%
- Docker 即學即用 / 23%
- Docker 錦囊妙計 / 0%
class Array | |
def gaga_map(&blk) | |
puts "---method #{__method__} start---" | |
output = [] | |
if block_given? | |
self.each do |item| | |
output << blk.call(item) | |
end | |
output = output.to_enum :gaga_map |
# 175梯教育役服勤處所分配表 | |
# http://maseduc.moe.gov.tw/board/upload/175%E6%A2%AF%E5%BD%99%E6%95%B4%E6%9C%8D%E5%8B%A4%E8%99%95%E6%89%80%E9%A0%90%E6%93%AC%E5%88%86%E9%85%8D%E8%A1%A8.xls | |
require 'spreadsheet' | |
workbook = Spreadsheet.open './175t.xls' | |
worksheets = workbook.worksheets | |
worksheets.each do |worksheet| | |
puts "Reading #{worksheet.name}" |
set nocompatible " be iMproved, required | |
filetype off " required | |
"// --- vim-plugin --- // | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') |
#!/bin/bash | |
# Install docker and add permission your user. | |
bash <(curl -s https://get.docker.com) | |
# Add user to docker group | |
sudo usermod -aG docker `whoami` |
* * * * * echo "Hello world" > /proc/$(cat /var/run/crond.pid)/fd/1 2>&1 |
#!/bin/bash | |
result=$(curl -i https://store.line.me/stickershop/product/1343605 2>/dev/null | head -n 1 | cut -d$' ' -f2) | |
while [ $result -ne "200" ] | |
do | |
echo $result | |
sleep 60 | |
done |
# Add these methods to your ApplicationController. Then, any controller | |
# that inherits from it will have these methods and can programmatically | |
# determine what filters it has set. | |
class ApplicationController < ActionController::Base | |
def self.filters(kind = nil) | |
all_filters = _process_action_callbacks | |
all_filters = all_filters.select{|f| f.kind == kind} if kind | |
all_filters.map(&:filter) | |
end |
編號. 書名 / 進度:
http://www.zhlwish.com/2012/07/23/rails-activesupport-concern/
# autoload concerns
module YourApp
class Application < Rails::Application
# config.autoload_paths += %W(
# #{config.root}/app/controllers/concerns/
# #{config.root}/app/models/concerns/
# )
module Ex25 | |
# This function will break up words for us. | |
def Ex25.break_words(stuff) | |
words = stuff.split(' ') | |
return words | |
end | |
# Sorts the words. | |
def Ex25.sort_words(words) |