Set the current locale.
Default is 'en'
.
$.li18n.currentLocale = 'de';
1. download from https://docs.oracle.com/cd/E11882_01/install.112/e38228/inst_task.htm#BJFHJIBH | |
- instantclient-basic-macos.x64-11.2.0.3.0.zip | |
- instantclient-sqlplus-macos.x64-11.2.0.3.0.zip | |
- instantclient-sdk-macos.x64-11.2.0.4.0.zip | |
2. unpack and place to /opt/oracle/instantclient_11_2 | |
3. set proper permissions | |
4. in ~/.bash_profile | |
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/oracle/instantclient_11_2 | |
export DYLD_LIBRARY_PATH | |
PATH=$PATH:/oracle/instantclient_11_2/ |
serialize :preferences | |
#helper for using serialized values in form | |
def self.serialized_attr_accessor(*args) | |
args.each do |method_name| | |
eval " | |
def #{method_name} | |
(self.preferences || {})[:#{method_name}] | |
end | |
def #{method_name}=(value) |
### Open cursors | |
select max(a.value) as highest_open_cur, p.value as max_open_cur | |
from v$sesstat a, v$statname b, v$parameter p | |
where a.statistic# = b.statistic# | |
and b.name = 'opened cursors current' | |
and p.name = 'open_cursors' | |
group by p.value; | |
### Find out the session that is causing the error by using the following SQL statement: | |
select a.value, s.username, s.sid, s.serial# |
require 'excon' | |
Excon.defaults[:ssl_verify_peer] = false | |
Excon.defaults[:ssl_ca_path] = ' /usr/lib/ssl' | |
CarrierWave.configure do |config| | |
if Rails.env.production? || Rails.env.staging? | |
config.storage = :fog | |
config.fog_credentials = { | |
provider: 'AWS', |
brew list -1 | while read line; do brew unlink $line; brew link $line; done |
Write a migration and ActiveRecord model that tracks restaurant reservations. Assume there is a table in your relational database named "reservations". Reservations have a start time, an end time and a table number. | |
Write some ActiveRecord validations that check new reservations for overbooking of the same table in the restaurant. For example, table #10 cannot have 2 reservations for the same period of time. This validation(s) should check time overlap for both record creation and updates. | |
Unit tests are a must to make sure your double booking validations are working. (rspec and unittests) |
namespace :paperclip_migration do | |
desc "migrate files from file storage to s3" | |
task :migrate_to_s3 => :environment do | |
puts "Migrating... carrierwave..." | |
Asset1.find_each do |record| | |
path = record.avatar.path.to_s | |
if path != record.avatar.default_url | |
file_path = (Rails.root.join('public', path) | |
if File.exists?(file_path) | |
file = File.open(file_path) |
def dice_rand | |
(1..10).inject(10) {|s,i| s + rand(6)} | |
end | |
def count_dice_avg(number) | |
res = Hash.new(0) | |
number.times { x = dice_rand; res[x] += 1} | |
res.sort_by {|k,v| v}.reverse | |
end |