class Hostel < ActiveRecord::Base
attr_accessible :name, :address_1...
# Model definition...
has_one :conditions, class_name: 'Hostel::Condition'
has_one :directions, class_name: 'Hostel::Direction'
end
class Hostel::Condition < ActiveRecord::Base
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pushes to heroku origin | |
# Call like this: | |
# >> rake deploy:heroku staging | |
# >> rake deploy:heroku production | |
namespace :deploy do | |
task :heroku do | |
current_branch = `git branch --no-color | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`.gsub("\n", "").gsub("* ", "") | |
deploy_to = ARGV[1].try(:dup) || 'staging' | |
sh "git push #{deploy_to} #{current_branch}:master -f" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias fucking='sudo' | |
alias be='bundle exec' | |
alias r='bundle exec rake' | |
alias fs='bundle exec foreman start' | |
alias rs='bundle exec rails server' | |
alias rg='bundle exec rails generate' | |
alias rc='bundle exec rails console' | |
alias log='tail -f log/*.log' | |
alias c='clear' | |
alias v='vim' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Include the authorization tokens if we're issuing an API request. | |
# By doing this, we can call the API and the system will include the authorization headers for us. | |
# http://api.jquery.com/jQuery.ajaxPrefilter/ | |
$.ajaxPrefilter (options, originalOptions, xhr) -> | |
is_request_to_api = (options.url.indexOf('<%= Settings.API.URL %>') == 0) | |
if is_request_to_api | |
xhr.setRequestHeader('Authorization', "Token token=\"<%= Settings.API.TOKEN %>\", signature=\"<%= Settings.API.SIGNATURE %>\", timestamp=\"<%= Settings.API.TIMESTAMP %>\"") | |
return | |
# Get the user location using our API |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template = require 'views/templates/hostels/search' | |
CollectionView= require 'views/base/collection-view' | |
HostelItemView = require 'views/hostels/item' | |
module.exports = class HostelSearchView extends CollectionView | |
className: 'search-results' | |
itemView: HostelItemView | |
template: template | |
listSelector: '.hostels' | |
fallbackSelector: '.empty-message' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql -u root -p -e"show processlist;"|awk '{print $3}'|awk -F":" '{print $1}'|sort|uniq -c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get -y update | |
apt-get -y install build-essential | |
apt-get -y install make | |
apt-get install memcached | |
#cd /tmp | |
#wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p327.tar.gz | |
#tar -xvzf ruby-1.9.3-p327.tar.gz | |
#cd ruby-1.9.3-p327/ | |
#./configure --prefix=/usr/local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get -y update | |
apt-get -y upgrade | |
apt-get -y install redis-server |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd ~ | |
sudo apt-get update | |
sudo apt-get install openjdk-7-jre-headless -y | |
wget https://github.com/elasticsearch/elasticsearch/archive/v0.20.1.tar.gz -O elasticsearch.tar.gz | |
tar -xf elasticsearch.tar.gz | |
rm elasticsearch.tar.gz | |
sudo mv elasticsearch-* elasticsearch | |
sudo mv elasticsearch /usr/local/share |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ============================================================= | |
# REQUIREMENTS | |
# ============================================================= | |
# - Heroku toolbelt installed in your system | |
# - A heroku remote named `staging`. | |
# - A heroku remote named `production`. | |
# ============================================================= | |
namespace :h do | |
# ------------------------------------------------------------- |