Tested in Mac OS X: super == command
Open/Goto
- super+t: go to file
- super+ctrl+p: go to project
- super+r: go to methods
class Alert < ActiveRecord::Base | |
belongs_to :alertable, :polymorphic => true | |
end | |
class Region < ActiveRecord::Base | |
has_many :alerts, :as => :alertable | |
end | |
ActiveAdmin::Dashboards.build do | |
# Add this section in your dashboard... | |
section "Background Jobs" do | |
now = Time.now.getgm | |
ul do | |
li do | |
jobs = Delayed::Job.where('failed_at is not null').count(:id) | |
link_to "#{jobs} failing jobs", admin_jobs_path(q: {failed_at_is_not_null: true}), style: 'color: red' | |
end |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<title>javaScript正则表达式提取字符串中字母、数字、中文</title> | |
</head> | |
<body> | |
<input type="text" id="oText" value="李秉骏的常用代号是96347,英文名字是CashLee噢" size=100><br/> | |
<input type="button" value="number" onclick="get_character_you_want(this);"> |
RVM home page: http://rvm.beginrescueend.com | |
Install RVM | |
------------ | |
See http://rvm.beginrescueend.com/rvm/install/ | |
bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) | |
Install rvm for all users |
install PostgreSQL 9 in Mac OSX via Homebrew | |
Mac OS X Snow Leopard | |
System Version: Mac OS X 10.6.5 | |
Kernel Version: Darwin 10.5.0 | |
Install notes for PostgreSQL 9.0.1 install using Homebrew: | |
sh-3.2# brew install postgresql |
# Extend hashes by adding one method that allows you to split a hash into an array of equal-sized hashes. | |
# Filter items to be included in the result by adding a selecting block that returns true | |
# if the key/value is to be kept. | |
# Per the usage example, return values are not ordered unless you're using Ruby 1.9 | |
# usage: | |
# a = {1 => 'a', 2 => 'b', 3 => 'c', 4 => 'd', 5 => 'e'} | |
# a.split_into(3) {|k,v| k.instance_of?(Integer)} |
require 'net/http' | |
require 'uri' | |
def get_html_content(requested_url) | |
url = URI.parse(requested_url) | |
full_path = (url.query.blank?) ? url.path : "#{url.path}?#{url.query}" | |
the_request = Net::HTTP::Get.new(full_path) | |
the_response = Net::HTTP.start(url.host, url.port) { |http| | |
http.request(the_request) |