查看硬盘:
# fdisk -l
...
Disk /dev/sdb: 274.9 GB, 274877906944 bytes
255 heads, 63 sectors/track, 33418 cylinders, total 536870912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
| def humanize secs | |
| [[60, :seconds], [60, :minutes], [24, :hours], [1000, :days]].map{ |count, name| | |
| if secs > 0 | |
| secs, n = secs.divmod(count) | |
| "#{n.to_i} #{name}" | |
| end | |
| }.compact.reverse.join(' ') | |
| end |
| # A class-based template for jQuery plugins in Coffeescript | |
| # | |
| # $('.target').myPlugin({ paramA: 'not-foo' }); | |
| # $('.target').myPlugin('myMethod', 'Hello, world'); | |
| # | |
| # Check out Alan Hogan's original jQuery plugin template: | |
| # https://github.com/alanhogan/Coffeescript-jQuery-Plugin-Template | |
| # | |
| (($, window) -> |
| require 'io/console' | |
| # Reads keypresses from the user including 2 and 3 escape character sequences. | |
| def read_char | |
| STDIN.echo = false | |
| STDIN.raw! | |
| input = STDIN.getc.chr | |
| if input == "\e" then | |
| input << STDIN.read_nonblock(3) rescue nil |
| (function($){ | |
| /** | |
| * Register ajax transports for blob send/recieve and array buffer send/receive via XMLHttpRequest Level 2 | |
| * within the comfortable framework of the jquery ajax request, with full support for promises. | |
| * | |
| * Notice the +* in the dataType string? The + indicates we want this transport to be prepended to the list | |
| * of potential transports (so it gets first dibs if the request passes the conditions within to provide the | |
| * ajax transport, preventing the standard transport from hogging the request), and the * indicates that | |
| * potentially any request with any dataType might want to use the transports provided herein. | |
| * |
| # lib/capistrano/tasks/assets.rake | |
| Rake::Task['deploy:assets:precompile'].clear | |
| namespace :deploy do | |
| namespace :assets do | |
| desc 'Precompile assets locally and then rsync to remote servers' | |
| task :precompile do | |
| local_manifest_path = %x{ls public/assets/manifest*}.strip |
| # be sure to comment out the require 'capistrano/deploy' line in your Capfile! | |
| # config valid only for Capistrano 3.1 | |
| lock '3.2.1' | |
| set :application, 'my-cool-application' | |
| # the base docker repo reference | |
| set :name, "johns-stuff/#{fetch(:application)}" |
| # http://zh.wikipedia.org/wiki/中文数字 | |
| # http://china.younosuke.com/03_013.html | |
| module ChineseNum | |
| extend self | |
| UPPER_ZERO = '零' | |
| LOWER_ZERO = '〇' | |
| UPPER_DIGITS = %w[壹 贰 叁 肆 伍 陆 柒 捌 玖].unshift nil | |
| LOWER_DIGITS = %w[一 二 三 四 五 六 七 八 九].unshift nil |
| create type coord as (x double precision, y double precision); | |
| create type geocoord as (lat double precision, lon double precision); | |
| create or replace function transform(x double precision, y double precision, out lat double precision, | |
| out lon double precision) | |
| language plpgsql as | |
| $$ | |
| declare | |
| xy double precision; |