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 ApplicationController < ActionController::Base | |
protect_from_forgery with: :exception | |
def authorize!(*roles) | |
unless current_user.allowed?(roles) | |
render text: 'You are not authorized to view this page' | |
end | |
end | |
end |
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
def update | |
respond_to do |format| | |
format.js { | |
if request.xhr? | |
@user = User.find(params[:id]) | |
params[:user][:location_ids] ||= [] | |
@user.assign_attributes(safe_params) | |
if @user.save | |
@users = users_list | |
render template: 'users/list' |
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
var args = require('system').args; | |
var page = require('webpage').create(); | |
var loc = encodeURIComponent(args[1]); | |
var pickup_date = encodeURIComponent(args[2]); | |
var pickup_time = encodeURIComponent(args[3]); | |
var return_date = encodeURIComponent(args[4]); | |
var return_time = encodeURIComponent(args[5]); | |
var url = "http://www.orbitz.com/shop/home?type=car&car.pickupType=AIRPORT&car.dropoffType=SAME&car.airport.orig.key=" + args[1] + "&car.airport.startDate=" + pickup_date + "&car.airport.pickupTime=" + pickup_time + "&car.airport.endDate=" + return_date + "&car.airport.dropoffTime=" + return_time + "&car.airport.airConditioning=U&car.airport.transmissionType=U&search=Search+Cars" | |
page.open(url, function() { |
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
server { | |
listen 192.168.11.100:80; | |
server_name foo.domain.com; | |
error_page 497 =301 https://$server_name$request_uri; | |
} | |
server { | |
listen 192.168.11.100:443 default_server ssl; | |
server_name foo.domain.com; |
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
user www-data; | |
worker_processes 4; | |
pid /run/nginx.pid; | |
events { | |
worker_connections 768; | |
# multi_accept on; | |
} | |
http { |
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
foo = %w(a b c) | |
=> ["a", "b", "c"] | |
foo.object_id | |
=> 2176910900 | |
foo += ['d'] | |
=> ["a", "b", "c", "d"] | |
foo.object_id | |
=> 2176867500 | |
foo = %w(a b c) | |
=> ["a", "b", "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
--> Downloading Phusion Passenger support binaries for your platform | |
Checking whether the downloaded Watchdog binary is usable | |
Checking whether the downloaded HelperAgent binary is usable | |
Checking whether the downloaded LoggingAgent binary is usable | |
All good | |
--> Downloading web helper for your platform | |
Checking whether the downloaded binary is usable | |
All good | |
--> Compiling passenger_native_support.bundle for the current Ruby interpreter... | |
(set PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0 to disable) |
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
= form_for @preferred_vendor, url: (action_name == 'new' ? new_preferred_vendor_path : preferred_vendor_path), as: 'preferred_vendor', html: { autocomplete: 'off' }, remote: true do |f| | |
= f.error_messages | |
%p | |
= f.label :name | |
%br | |
= f.text_field :name | |
%p | |
= f.label :item_code | |
%br | |
= f.text_field :item_code |
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
def collapse_hash_values(hash) | |
hash.each {|k,v| hash[k] = v.first} | |
end |
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
controller = $('body').data('controller') | |
action = $('body').data('action') | |
if controller is 'crs_reports' and action is 'booked_rates' |