start new:
tmux
start new with session name:
tmux new -s myname
| # (I recommend understanding the basics of this first: http://sequel.jeremyevans.net/rdoc/files/doc/object_model_rdoc.html) | |
| # Extending the underlying dataset (http://sequel.jeremyevans.net/rdoc/files/README_rdoc.html#label-Extending+the+underlying+dataset) | |
| # The recommended way to implement table-wide logic by defining methods on the dataset using dataset_module: | |
| class Post < Sequel::Model | |
| dataset_module do | |
| def posts_with_few_comments | |
| where{num_comments < 30} |
| DROP TABLE if exists d_date; | |
| CREATE TABLE d_date | |
| ( | |
| date_dim_id INT NOT NULL, | |
| date_actual DATE NOT NULL, | |
| epoch BIGINT NOT NULL, | |
| day_suffix VARCHAR(4) NOT NULL, | |
| day_name VARCHAR(9) NOT NULL, | |
| day_of_week INT NOT NULL, |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>comment</key> | |
| <string> | |
| TODO: unresolved issues | |
| text: |
| # db/migrate/20131118172653_create_transactional_items_view.rb | |
| class CreateTransactionalItemsView < ActiveRecord::Migration | |
| def up | |
| select_sql = File.open("#{Rails.root}/db/migrate/20131118172653_create_transactional_items_view.sql", 'r') { |f| f.read } | |
| # for materialized view: | |
| view_sql = "CREATE MATERIALIZED VIEW transactional_items AS (#{select_sql})" | |
| # for normal view: | |
| view_sql = "CREATE VIEW transactional_items AS (#{select_sql})" | |
| # Outputs this at warn log level: | |
| # 1.2.3.4 GET /path 200 OK BlahController#action HTML 938.2 (DB 11.8, View 719.7) {params} {optional params from flash[:log]} | |
| # | |
| # Save as config/initializers/oneline_detailed_logging.rb. Consider | |
| # decreasing the log level from "info" to "warn" (in production.rb) so | |
| # the one-line log message replaces the standard request logs. | |
| # override process_action to add 2 things to the payload: | |
| # - remote IP |
| # include from an initializer | |
| module HstoreAccessor | |
| def self.included(base) | |
| base.extend(ClassMethods) | |
| end | |
| module ClassMethods | |
| def hstore_accessor(hstore_attribute, *keys) | |
| Array(keys).flatten.each do |key| |
How to get rid of those pesky
WARNING: Nokogiri was built against LibXML version X, but has dynamically loaded Z
warnings on Mac OS X (Mountain) Lion:
gem uninstall nokogiri libxml-rubybrew updatebrew install libxml2 --with-xml2-configbrew install libxsltgem install nokogiri -- --with-xml2-include=/usr/local/opt/libxml2/include --with-xml2-lib=/usr/local/opt/libxml2/lib --with-xslt-dir=/usr/local/opt/libxslth1. Sublime Text 2 - Useful Shortcuts (Mac OS X)
h2. General
| # ~/.bash_login | |
| export PATH="/usr/local/bin:$PATH" |