sysctl -w fs.file-max=12000500
sysctl -w fs.nr_open=20000500
# Set the maximum number of open file descriptors
ulimit -n 20000000
# Set the memory size for TCP with minimum, default and maximum thresholds
sysctl -w net.ipv4.tcp_mem='10000000 10000000 10000000'
TL;DR
Create a backup:
pg_dumpall > mybackup.sql
Perform the upgrade:
sudo pg_dropcluster 9.4 main --stop
This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.
I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.
Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.
# Speed things up by not loading Rails env | |
config.assets.initialize_on_precompile = false |
@interface MKMapView (Extensions) | |
-(double)as_zoomLevel; | |
-(void)as_setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(NSUInteger)zoomLevel animated:(BOOL)animated; | |
@end | |
static double mercadorRadius = 85445659.44705395; | |
static double mercadorOffset = 268435456; |
Font size adjustment plugin for PhoneGap on Android: a simple PhoneGap plugin that allows you to dynamically modify the WebView's textSize property in order to make the text larger/smaller.
Usage:
// increase the font size by one unit (units are [50%,75%,100%,150%,200%])
window.plugins.fontSizeAdjust.increase(myCallback(newFontSizeAsPercent){});
// decrease the font size by one unit
window.plugins.fontSizeAdjust.decrease(myCallback(newFontSizeAsPercent){});
require 'addressable/uri' | |
#Accepts options[:message] and options[:allowed_protocols] | |
class UriValidator < ActiveModel::EachValidator | |
def validate_each(record, attribute, value) | |
uri = parse_uri(value) | |
if !uri | |
record.errors[attribute] << generic_failure_message | |
elsif !allowed_protocols.include?(uri.scheme) |
set :stage, 'production' | |
set :shared_children, shared_children << 'tmp/sockets' | |
puma_sock = "unix://#{shared_path}/sockets/puma.sock" | |
puma_control = "unix://#{shared_path}/sockets/pumactl.sock" | |
puma_state = "#{shared_path}/sockets/puma.state" | |
puma_log = "#{shared_path}/log/puma-#{stage}.log" | |
namespace :deploy do | |
desc "Start the application" |
class AssetHeaders | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
request = Rack::Request.new(env) | |
response = @app.call(env) | |
if request.path =~ /^\/assets\// | |
# there maybe a better way to add headers |