-
Open the Terminal
-
Use
mysqldump
to backup your databases -
Check for MySQL processes with:
ps -ax | grep mysql
-
Stop and kill any MySQL processes
-
Analyze MySQL on HomeBrew:
brew remove mysql
require 'json' | |
require 'yaml' | |
input_filename = ARGV[0] | |
output_filename = input_filename.sub(/(yml|yaml)$/, 'json') | |
input_file = File.open(input_filename, 'r') | |
input_yml = input_file.read | |
input_file.close |
Moved to git repository: https://github.com/denji/nginx-tuning
For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.
Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon
with HyperThreading enabled, but it can work without problem on slower machines.
You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.
Web fonts are pretty much all the rage. Using a CDN for font libraries, like TypeKit or Google Fonts, will be a great solution for many projects. For others, this is not an option. Especially when you are creating a custom icon library for your project.
Rails and the asset pipeline are great tools, but Rails has yet to get caught up in the custom web font craze.
As with all things Rails, there is more then one way to skin this cat. There is the recommended way, and then there are the other ways.
Here I will show how to update your Rails project so that you can use the asset pipeline appropriately and resource your files using the common Rails convention.
def median_split(arr) | |
c = arr.size%2 | |
subset = [arr[0..arr.size/2-1], arr[arr.size/2+c..-1]] | |
m = median arr | |
subset[0].push m | |
subset[1].unshift m | |
subset | |
end | |
def median(arr) |
Clean Code (great general 'write better code' book) - http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882
Growing OO Software Guided By Tests (GREAT TDD book, good for beginners and experienced alike) - http://www.amazon.com/Growing-Object-Oriented-Software-Guided-Tests/dp/0321503627
Refactoring - http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672
# SSL self signed localhost for rails start to finish, no red warnings. | |
# 1) Create your private key (any password will do, we remove it below) | |
$ openssl genrsa -des3 -out server.orig.key 2048 | |
# 2) Remove the password | |
$ openssl rsa -in server.orig.key -out server.key |
t = 236 # seconds | |
Time.at(t).utc.strftime("%H:%M:%S") | |
=> "00:03:56" | |
# Reference | |
# http://stackoverflow.com/questions/3963930/ruby-rails-how-to-convert-seconds-to-time |
states = Array[ ["AK", "Alaska"], | |
["AL", "Alabama"], | |
["AR", "Arkansas"], | |
["AS", "American Samoa"], | |
["AZ", "Arizona"], | |
["CA", "California"], | |
["CO", "Colorado"], | |
["CT", "Connecticut"], | |
["DC", "District of Columbia"], | |
["DE", "Delaware"], |
#!/usr/bin/env ruby | |
# | |
# Passenger Process Monitor | |
# | |
# By Darren Oakley | |
# Based heavily on a script by James Smith (https://gist.github.com/851520) | |
# That in turn was based on a similar script by Jon Bettcher | |
# | |
# - Check memory usage of all paseenger child process and kill if grows too large. |