最後編輯 2020-11-01
列舉的種類基本上是生產力、健康相關,或是好用的工程師潮流精品(?)
這些是我偏好或想要的裝備,歡迎留言提供其他推薦裝備、發問為何要用或不用某個裝備、品牌。
免費的工具軟體雖然也很重要,但不在這邊討論,有興趣請查看 我的 Mac 環境設定。
| class Notifier | |
| def initialize(voice) | |
| @voice | |
| end | |
| def sprint | |
| say "sprint" | |
| puts %( | |
| ###### ######## ######## #### ## ## ######## | |
| ## ## ## ## ## ## ## ### ## ## |
最後編輯 2020-11-01
列舉的種類基本上是生產力、健康相關,或是好用的工程師潮流精品(?)
這些是我偏好或想要的裝備,歡迎留言提供其他推薦裝備、發問為何要用或不用某個裝備、品牌。
免費的工具軟體雖然也很重要,但不在這邊討論,有興趣請查看 我的 Mac 環境設定。
| module Timer | |
| def times(env) | |
| value_s = env['interval'] | |
| if value_s == nil | |
| raise "interval missing" | |
| end | |
| value = Integer(value_s) | |
| if value <= 0 | |
| raise "interval should be > 0" |
| content = "這是標題之前<h1>這是標題</h1>這是標題之後" | |
| content.gsub(/\<h1(.*)\<\/h1\>/, '<h2\1</h2>') | |
| => "這是標題之前<h2>這是標題</h2>這是標題之後" | |
| # 重點在於 match 時的 () 包起來的東西變成 \1 (但必須用單引號 '' 才有效) |
| # source: http://jokercatz.blogspot.tw/2013/09/rails-get-all-models.html | |
| #first load all models | |
| Rails.application.eager_load! | |
| #okay…each now :) | |
| ActiveRecord::Base.send(:subclasses).each do |model| | |
| puts model.name | |
| end |
| require 'benchmark' | |
| require "active_support/core_ext/object/blank" | |
| TIMES = 1000000 | |
| Benchmark.bmbm do |x| | |
| x.report("if present? (actually present)") do | |
| TIMES.times do | |
| if "1".present? |
| # encoding: utf-8 | |
| # work-around from http://stackoverflow.com/a/15017892 | |
| required_version_gems = %w( | |
| awesome_print-1.2.0 | |
| hirb-0.7.2 | |
| hirb-unicode-0.0.5 | |
| unicode-display_width-0.1.1 | |
| ) | |
| required_version_gems.each do |version_gem| |
| # Available cops (199) + config for /Users/bruce/Projects/rails: | |
| # Type 'Lint' (36): | |
| Lint/AmbiguousOperator: | |
| Description: Checks for ambiguous operators in the first argument of a method invocation | |
| without parentheses. | |
| StyleGuide: https://github.com/bbatsov/ruby-style-guide#parens-as-args | |
| Enabled: false | |
| Lint/AmbiguousRegexpLiteral: | |
| Description: Checks for ambiguous regexp literals in the first argument of a method |
| curl -X POST -F "id={the url}" -F "scrape=true" "https://graph.facebook.com" | |
| # from http://stackoverflow.com/questions/12100574/is-there-an-api-to-force-facebook-to-scrape-a-page-again |
| javascript: ! function() { | |
| $(".js-num-cards").each(function(i) { | |
| var size = $(".js-list:nth(" + i + ") .list-card-details").length; | |
| $(".js-num-cards:nth(" + i + ")").text(size + " cards"); | |
| }); | |
| $(".js-num-cards").toggleClass('hide'); | |
| if ($(".board-header-btn-name .js-list-card-count").length === 0) { | |
| $(".board-header-btn-name span").append(" <span class=\"js-list-card-count\"></span>"); |