NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
| <?php | |
| /** | |
| * Geohash | |
| * | |
| * @author Keisuke SATO | |
| * @license MIT License | |
| * | |
| * # Based | |
| * http://github.com/davetroy/geohash-js/blob/master/geohash.js | |
| * Geohash library for Javascript | 
| # lib/asset_fingerprints.rb -- A hack to get asset_hash to play nice with Rails 2.3.11 (since there is no ActionController::Base.asset_path configuration option). | |
| # Same as deployment nginx configuration. | |
| # No font/woff because it is already compressed: | |
| # http://www.pixelastic.com/blog/87:gzipping-your-font-files | |
| AssetHash::Base.gzip_types = %w( | |
| application/javascript | |
| application/json | |
| application/xml | 
| class Setting < ActiveRecord::Base | |
| validates_uniqueness_of :var | |
| validates_presence_of :value | |
| after_save :send_cron_later | |
| #Setting.for(:display).set=(value) | |
| def self.for(var) | |
| find_or_create_by_var(var) | 
| literally always have to look up the meaning of :limit in migrations when it comes to integer values. Here's an overview. Now let's memorise it (oh, this works for MySQL, other databases may work differently): | |
| :limit Numeric Type Column Size Max value | |
| 1 tinyint 1 byte 127 | |
| 2 smallint 2 bytes 32767 | |
| 3 mediumint 3 byte 8388607 | |
| nil, 4, 11 int(11) 4 byte 2147483647 | |
| 5..8 bigint 8 byte 9223372036854775807 | |
| Note: by default MySQL uses signed integers and Rails has no way (that I know of) to change this behaviour. Subsequently, the max. values noted are for signed integers. | 
| // Fix to make zepto work with ujs-jquery | |
| $.fn.ajaxSend = function(callback) { | |
| return this.each(function(){ | |
| $(this).on('ajaxBeforeSend', callback); | |
| }); | |
| }; | |
| var jQuery = $; | 
| class ApplicationController < ActionController::Base | |
| ... | |
| #Problem: | |
| #In rails 3.0.1+ it is no longer possible to do this anymore; | |
| # rescue_from ActionController::RoutingError, :with => :render_not_found | |
| # | |
| #The ActionController::RoutingError thrown is not caught by rescue_from. | |
| #The alternative is to to set a catch-all route to catch all unmatched routes and send them to a method which renders an error | |
| #As in http://techoctave.com/c7/posts/36-rails-3-0-rescue-from-routing-error-solution | 
| /** | |
| * Module dependencies. | |
| */ | |
| var express = require('express') | |
| , routes = require('./routes') | |
| , http = require('http'); | |
| var app = express(); | |
| var server = app.listen(3000); | 
| # Install Dependencies | |
| # sudo apt-get install build-essential | |
| # sudo apt-get build-dep php5 | |
| sudo apt-get install libmysqlclient-dev mysql-client libcurl4-openssl-dev libgd2-xpm-dev libjpeg-dev libpng3-dev libxpm-dev libfreetype6-dev libt1-dev libmcrypt-dev libxslt1-dev bzip2 libbz2-dev libxml2-dev libevent-dev libltdl-dev libmagickwand-dev libmagickcore-dev imagemagick libreadline-dev libc-client-dev libsnmp-dev snmpd snmp libvpx-dev libxpm-dev libgmp3-dev libicu-dev libpspell-dev libtidy-dev freetds-dev unixodbc-dev librecode-dev libglib2.0-dev libsasl2-dev libgeoip-dev imagemagick libmagickcore-dev libmagickwand-dev | |
| # Stop Apache | |
| sudo service apache2 stop | |
| # Cleanup Packages | |
| sudo apt-get autoremove | 
NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.