chrome://inspect/#devices
localhost:8999
chrome://flags/#enable-devtools-experiments
http://www.html5rocks.com/en/tutorials/developertools/revolutions2013/?redirect_from_locale=zh
adb forward tcp:8999 localabstract:chrome_devtools_remote
http://stackoverflow.com/questions/3877027/jquery-callback-on-image-load-even-when-the-image-is-cached
https://github.com/medcl/elasticsearch-analysis-ik/archive/v1.2.6.zip
unzip v1.2.6.zip
sudo -i
cd /usr/share/elasticsearch
cd plugins
bin/plugin -install medcl/elasticsearch-analysis-ik/1.2.6
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
https://about.gitlab.com/downloads/ https://about.gitlab.com/2014/02/14/gitlab-is-now-simple-to-install/
# Set to :debug to see everything in the log. | |
config.log_level = ENV["LOG_LEVEL"].present? ? ENV["LOG_LEVEL"] : :info |
这次应该搞定了
Francis.J 2014-9-4 11:30:02
zone_default = Time.find_zone!("Asia/Shanghai")
Time.zone_default = zone_default
ActiveRecord::Base.time_zone_aware_attributes = true
ActiveRecord::Base.default_timezone = :utc
- http://www.sitepoint.com/understanding-sql-joins-mysql-database/
- http://blog.bigbinary.com/2013/07/01/preload-vs-eager-load-vs-joins-vs-includes.html
user_id = 11
Task.joins("left JOIN ownerships ON ownerships.subject_id = tasks.id AND ownerships.subject_type = 'Task'").where("ownerships.subject_type" => "Task", user_id: 11).select("distinct '#{subject_klass.table_name}.id'").select("#{subject_klass.table_name}.*")
Task.joins("left JOIN ownerships ON ownerships.subject_id = tasks.id AND ownerships.subject_type = 'Task'").where("ownerships.subject_type" => "Task", user_id: 11).group("#{subject_klass.table_name}.id")
sharing-a-devise-user-session-across-subdomains
two key words, sample cookie_store key and secret_key_base devise_secret_key
Rails.application.config.session_store :cookie_store, key: "vcooline_ikcrm#{Rails.env}_#{SESSION_DOMAIN.try(:underscore)}_session", :domain => :all, :expire_after => 86400*90, :tld_length => 2
You might get weird things like halfway Devise sessions sharing, but only allowing you to create and destroy the session on the root domain. Using :all works great if you’re using localhost, but when I started using lvh.me:3000 for testing I had those problems (lvh.me stands for local vhost me and is a domain that simply points to localhost which makes for zero-config subdomain development. It’s super handy.).
get 'crm_base_agent/', to: "crm_base_agent#index"
http://askubuntu.com/questions/36930/is-a-nvidia-geforce-with-optimus-technology-supported-by-ubuntu
http://askubuntu.com/questions/457446/ubuntu-14-04-nvidia-prime-is-it-supported-no?rq=1
https://wiki.ubuntu.com/Bumblebee
sudo apt-get install bumblebee bumblebee-nvidia primus nvidia-331
Usage
Array.prototype.each_slice = function (size, callback){ | |
for (var i = 0, l = this.length; i < l; i += size){ | |
callback.call(this, this.slice(i, i + size)); | |
} | |
}; | |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10].each_slice(3, function (slice){ | |
console.log(slice); | |
}); |
// Add an URL parser to JQuery that returns an object | |
// This function is meant to be used with an URL like the window.location | |
// Use: $.parseParams('http://mysite.com/?var=string') or $.parseParams() to parse the window.location | |
// Simple variable: ?var=abc returns {var: "abc"} | |
// Simple object: ?var.length=2&var.scope=123 returns {var: {length: "2", scope: "123"}} | |
// Simple array: ?var[]=0&var[]=9 returns {var: ["0", "9"]} | |
// Array with index: ?var[0]=0&var[1]=9 returns {var: ["0", "9"]} | |
// Nested objects: ?my.var.is.here=5 returns {my: {var: {is: {here: "5"}}}} | |
// All together: ?var=a&my.var[]=b&my.cookie=no returns {var: "a", my: {var: ["b"], cookie: "no"}} | |
// You just cant have an object in an array, ?var[1].test=abc DOES NOT WORK |