Install node-repl-promised:
npm install -g repl-promised
Use the repl to list all users
$ node-promised
> var app = require('./app');
undefined
> var Bookshelf = app.get('bookshelf');
undefined
client = Client.new(name: 'Treeni') | |
client.save! | |
files = Dir["app/models/*.rb"] | |
models = files.map { |file| file.split('/').last.sub(/\.rb/, '').camelize.constantize }.select { |i| i != Client } | |
models.each { |model| model.update_all(client_id: client._id) } |
Install node-repl-promised:
npm install -g repl-promised
Use the repl to list all users
$ node-promised
> var app = require('./app');
undefined
> var Bookshelf = app.get('bookshelf');
undefined
(function(ctx, $, undefined){ | |
$(document).ready(function(){ | |
bindEvent(); | |
}) | |
function bindEvent () { | |
//private scope for application | |
} |
var SiteArray = ['google.com','webonise.com','facebook.com','techcrunch.com','indiatimes.com']; | |
var dns = require('dns'); | |
for(var i = 0 ; i < SiteArray.length ; i++){ | |
dns.lookup(SiteArray[i],function(err,ip){ | |
if (err) return handleError(err); | |
console.log( " %s resolved to %s ", SiteArray[i],ip ); | |
}); | |
} |
sudo add-apt-repository ppa:pitti/postgresql | |
sudo apt-get update | |
sudo apt-get install postgresql-9.2 postgresql-server-dev-9.2 postgresql-contrib-9.2 | |
sudo su -l postgres | |
psql -d template1 -p 5433 | |
CREATE EXTENSION IF NOT EXISTS hstore; | |
CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; | |
service postgresql stop | |
/usr/lib/postgresql/9.2/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.2/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.2/main/ -O "-c config_file=/etc/postgresql/9.2/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf" |
base64 original_img.png | base64 --decode > ~/dest/decoded_image.png |
class CreatePlaces < ActiveRecord::Migration | |
# Rails migration for GeoWorldMap db into postgresql db | |
#(inspired by http://blog.inspired.no/populate-your-database-with-free-world-cities-countries-regions-in-2-minutes-using-a-rails-migration-273/ post) | |
#extract files from GeoWorldMap.zip archive from here | |
# http://www.geobytes.com/GeoWorldMap.zip | |
# | |
#and place them into #{Rails.root}/db/migrate/ | |
##the archive has 'cities.txt' file, rename it 'Cities.txt' | |
#mv cities.txt Cities.txt |
In the seemlingly endless search for the actual correct and easy way to deploy a Rails app, we have tried several ways. We tried out using Apache2 and running a cluster of Thin servers. With the built in threading of Puma we decided to use it with Nginx.
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |