This file contains 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
test = ["Motorola", "X", "2nd", "Gen", "Moto", "Blackbery"] | |
test.each do |i| | |
uri = URI.parse("http://xyz#{i}") | |
res = Net::HTTP.get(uri) | |
end | |
assests_types = ["/images/dummy/","/js/vendor/","/css/vendor"] | |
assets_base_path ="/JavascriptProjects/frontend/src/main/webapp/resources" |
This file contains 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
# Gzip Initial GZIP Rule javascript only | |
if ((beresp.status == 200 || beresp.status == 404) && (beresp.http.content-type ~ "^(text\/html|application\/x\-javascript|aapplication\/javascript|text\/javascript)\s*($|;)" || req.url ~ "\.(js|ttf|woff)($|\?)" ) ) { | |
# always set vary to make sure uncompressed versions dont always win | |
if (!beresp.http.Vary ~ "Accept-Encoding") { | |
if (beresp.http.Vary) { | |
set beresp.http.Vary = beresp.http.Vary ", Accept-Encoding"; | |
} else { | |
set beresp.http.Vary = "Accept-Encoding"; | |
} |
This file contains 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
Architecture: Rails 3.2, Solr 1.4 with sunspot_solr gem, Apache HTTP server as reverse proxy to | |
Rails app, Jquery UI | |
Note: I don't care about the distinction between autocomplete and autosuggest. I am implementing what some | |
people call autosuggest, and I'm calling it autocomplete. | |
Given the above existing architecture, I want to add an autocomplete field into my app for a single | |
attribute on a single model. It needs to be fast and secure (duh). The search target field could have | |
white space and the search input should allow it, e.g., if I search with "iker's gui" it should return |
This file contains 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
if ( u_has_birthday_today() ) | |
{ | |
say_happy_birthday(); | |
while ( !is_stomach_full() ) | |
{ | |
aquire_cake(); | |
} | |
} | |
else | |
{ |
This file contains 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
db.notifications.aggregate({ "$group" => { | |
"_id" => { | |
"nagios_hostname" => "$nagios_hostname", | |
"nagios_state" => "$nagios_state", | |
"nagios_service" => "$nagios_service", | |
"nagios_epoch" => "$nagios_epoch" | |
}, | |
"stateCount" => { "$sum" => 1 } | |
}}, | |
{ "$group" => { |
This file contains 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
sql = "SELECT tablename FROM pg_tables WHERE schemaname = 'public' ORDER BY tablename;" | |
tables = ActiveRecord::Base.connection.execute(sql) | |
tables_size={} | |
tables.each do |table| | |
name = table['tablename'] | |
sql = "SELECT pg_size_pretty(pg_total_relation_size('#{name}'));" | |
res = ActiveRecord::Base.connection.execute(sql) | |
puts "#{name} #{res[0]['pg_size_pretty']}" | |
tables_size["#{name}"] = res[0]['pg_size_pretty'] | |
puts tables_size |
This file contains 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 | |
require "single_sign_out" | |
before_filter :authenticate_user! | |
include SingleSignOut | |
#NOTE: Define this will inspect logger info of paramenter,controller name and action | |
def print_logger_info parameter | |
logger.info "######{" Controller : "+params[:controller]+" "}#################{" Action : "+params[:action]+" "}###########{" Parameters : "+parameter.inspect+" "}#############}" if Rails.env.development? | |
logger.info "###=>>>>>>>>>>>>>>>>>>session['cas_last_valid_ticket']###{session['cas_last_valid_ticket'].inspect}" |
This file contains 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
tarted POST "/nfhs_shop/orders/update_order" for 72.49.253.235 at 2014-08-26 11:03:07 +0000 | |
Processing by Spree::OrdersController#update_order as */* | |
Parameters: {"option_id"=>"", "product_id"=>"419", "previous_variant"=>"578976", "buy_type"=>"Yourself"} | |
undefined method `variants' for nil:NilClass | |
["/var/www/www.nfhslearn.com/releases/20140826103506/app/controllers/spree/orders_controller_decorator.rb:48:in `update_order'", "/var/www/www.nfhslearn.com/shared/Installed_bundle/ruby/1.9.1/gems/actionpack-3.2.16/lib/action_controller/metal/implicit_render.rb:4:in `send_action'", "/var/www/www.nfhslearn.com/shared/Installed_bundle/ruby/1.9.1/gems/actionpack-3.2.16/lib/abstract_controller/base.rb:167:in `process_action'", "/var/www/www.nfhslearn.com/shared/Installed_bundle/ruby/1.9.1/gems/actionpack-3.2.16/lib/action_controller/metal/rendering.rb:10:in `process_action'", "/var/www/www.nfhslearn.com/shared/Installed_bundle/ruby/1.9.1/gems/actionpack-3.2.16/lib/abstract_controller/callbacks.rb:18:in `block in proc |
This file contains 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
users = ["xxxxx@xxxxx.com","xxxx@xxxx.com"] | |
users.each do |i| | |
user = User.where(:email => i).first | |
puts "USER ADMIN CREATION=>>>> #{user.class}" | |
user.add_role :SuperAdmin | |
end |
This file contains 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
# if the request is for a static resource, nginx should serve it directly | |
location ~ ^/(images|javascripts|stylesheets|system|assets|jwplayer)/* { | |
root /var/www/www.example.com/current/public; | |
add_header Last-Modified ""; | |
add_header ETag ""; | |
expires max; | |
break; | |
} |