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
# These are examples of new features in Ruby 2.3.0 | |
#--------------------------------------------------------------------------- | |
## Did You Mean? | |
"Typos suck less now".revers | |
# NoMethodError: undefined method `revers' for "Typos suck less now":String | |
# Did you mean? reverse | |
# reverse! |
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
# -*- coding: utf-8 -*- | |
$:.unshift('/Library/RubyMotion/lib') | |
require 'motion/project/template/ios' | |
require 'bundler' | |
Dir.glob('./config/*.rb').each { |file| require file } | |
if ARGV.join(' ') =~ /spec/ | |
Bundler.require :default, :development, :spec | |
elsif ARGV.join(' ') =~ /testflight/ |
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
# Start Puma with next command: | |
# RAILS_ENV=production bundle exec puma -C ./config/puma.rb | |
# uncomment and customize to run in non-root path | |
# note that config/puma.yml web path should also be changed | |
application_path = "#{File.expand_path("../..", __FILE__)}" | |
# The directory to operate out of. | |
# | |
# The default is the current directory. |
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
worker_processes 1; | |
user nobody nogroup; | |
pid /tmp/nginx.pid; | |
error_log /tmp/nginx.error.log; | |
events { | |
worker_connections 1024; | |
accept_mutex off; | |
} | |
http { | |
default_type application/octet-stream; |
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
class Friendship < ActiveRecord::Base | |
attr_accessible :friend_id, :user_id, :status | |
belongs_to :user | |
belongs_to :friend, :class_name => 'User', :counter_cache => :friends_count | |
def self.request(user, friend) | |
unless user == friend or Friendship.where(:user_id => user, :friend_id => friend).exists? | |
transaction do | |
create({:user => user, :friend => friend, :status => 'pending'}, :without_protection => true) | |
create({:user => friend, :friend => user, :status => 'requested'}, :without_protection => true) |