Server: Nginx with Phusion Passenger
Ruby Version: 2.1.3
User System: deploy
# lib/tasks/db.rake | |
namespace :db do | |
desc "Dumps the database to db/APP_NAME.dump" | |
task :dump => :environment do | |
cmd = nil | |
with_config do |app, host, db, user| | |
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump" | |
end | |
puts cmd |
{ | |
"users" : [ | |
"occaecat", | |
"veniam", | |
"nisi", | |
"aute", | |
"est", | |
"cupidatat", | |
"id", | |
"consectetur", |
class Residency < ActiveRecord::Base | |
scope :filter, lambda { |query, *attributes| | |
return if query.blank? | |
attributes = self.new.attributes.keys if attributes.empty? | |
query.split(/\s/).inject(self) do |collection, phrase| | |
conditions = [""] | |
attributes.each do |attribute| | |
conditions[0] << attribute.to_s << " ILIKE ? OR " |
# Login as root | |
ssh root@domain | |
# Create deploy user | |
adduser <username> #Adds User with username given. Enter Password when Prompted. Other Details are Optional | |
# Add user to sudo group | |
usermod -g <groupname> <username> | |
# Add .ssh/authorized_keys for deploy user |
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.
ERB File
# api/v1/posts/index.json.jbuilder
json.pagination paginate(@collection)
API Paginate Helper
Ruby
#/etc/init.d/dropbox | |
start() { | |
echo "Starting dropbox..." | |
start-stop-daemon -b -o -c dropbox -S -x /dropbox/.dropbox-dist/dropboxd | |
} | |
stop() { | |
echo "Stopping dropbox..." | |
start-stop-daemon -o -c dropbox -K -x /dropbox/.dropbox-dist/dropboxd |
Install dependecies:
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
RVM Installation:
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
<?php /* Template Name: Products */ ?> | |
<?php get_header()?> | |
<script type="text/javascript"> | |
<?php | |
$pod = pods('product'); | |
$params = array( | |
"where" => "d.product_price" | |
); | |
$pod->find($params,$limit=-1); |