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 MainsController < ApplicationController | |
def index | |
if @search = City.search(params[:q]).blank? | |
@cities = @search.result | |
elsif @search = State.search(params[:q]).blank? | |
@states = @search.result | |
else | |
@search = Country.search(params[:q]) | |
@countries= @search.result |
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
1.9.3-p392 :002 > City.find(1) | |
City Load (20.0ms) SELECT "cities".* FROM "cities" WHERE "cities"."id" = ? LIMIT 1 [["id", 1]] | |
=> #<City id: 1, state_id: 1, name: "Bangalore", overview: "Bangalore is the capital city of the Indian state ...", fact: "test test test test test test test test test test t...", top_industries: "test test test test test test test test test test t...", judicial_system: "test test test test test test test test test test t...", business_real_estate: "test test test test test test test test test test t...", regulatory_authorities: "test test test test test test test test test test t...", created_at: "2013-10-21 11:20:44", updated_at: "2013-10-21 11:20:44"> | |
1.9.3-p392 :003 > City.search("id=129378198273") | |
NoMethodError: undefined method `with_indifferent_access' for "id=129378198273":String | |
from /home/zeptor2/.rvm/gems/ruby-1.9.3-p392/gems/ransack-0.7.2/lib/ransack/search.rb:21:in `initialize' | |
from /home/zeptor2/.rvm/gems/ruby-1.9.3-p392/gems/ransack-0.7.2/lib/ransack/adapters/ac |
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
1.9.3-p392 :006 > City.search(:id_eq => 12381723981273) | |
=> Ransack::Search<class: City, base: Grouping <conditions: [Condition <attributes: ["id"], predicate: eq, values: [12381723981273]>], combinator: and>> |
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
<%= search_form_for @search do |f| %> | |
<div class="field"> | |
<%= f.label :name_cont, "Name contains" %> | |
<%= f.text_field :name_cont %> | |
</div> | |
<div class="actions"><%= f.submit "Search" %></div> | |
<% 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
#include <iostream> | |
#include <cmath> | |
inline float fast_log(float val) | |
{ | |
int * const exp_ptr = reinterpret_cast <int *>(&val); | |
int x = *exp_ptr; | |
const int log_2 = ((x >> 23) & 255) - 128; | |
x &= ~(255 << 23); | |
x += 127 << 23; |
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
sudo apt-get install libcurl4-openssl-dev pkg-config libtool libncurses5-dev libudev-dev screen xterm | |
sudo apt-get install git-core | |
sudo apt-get install openssh-server byobu | |
sudo apt-get install autoconf | |
sudo apt-get install automake | |
wget "https://www.dropbox.com/s/eur5g46om5x7mx6/cgminer-3.7.0.tar.bz2" | |
https://www.dropbox.com/s/ye8ey32wg9phudv/ADL_SDK_6.0.zip | |
https://www.dropbox.com/s/iwf97gofte4bp27/AMD-APP-SDK-v2.9-lnx32.tgz | |
cd /opt |
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
rails g scaffold OPHTHALMOLOGY name:string hospital_no:integer complaints:string present_history:string past_history:string pallor:string oedema:string bp:string pulse:string cardiovascular_system:string respiratory_system:string respiratory_system:string alimentary_system:string central_nervous_system:string position_of_head:string position_of_eyeball:string ocular_movements:string visual_activity:string retinoscopy_bcva:string eyebrows_eyelashes:string lids:string conjuctiva_cornea:string anterior_chamber:string iris:string lens:string pupil:string pupillary_reactions:string ciliary_tenderness:string introcular_pressure:string lacrimal_sac:string fundus_examination:string silt_lamp_examination:string diagnosis:string |
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 User | |
include Mongoid::Document | |
include Mongoid::Timestamps | |
# Include default devise modules. Others available are: | |
# :confirmable, :lockable, :timeoutable and :omniauthable | |
devise :database_authenticatable, :registerable, | |
:recoverable, :rememberable, :trackable, :validatable | |
## Database authenticatable | |
field :email, type: String, default: "" |
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
{ | |
"Cube9 Ventures" : { | |
"Devices" : { | |
"PL2014000001" : { | |
"HWVersion" : "0000001", | |
"ModuleInfo" : "Module info comes here", | |
"Date Of Installation" : "24/07/2014", | |
"Controls" : { |
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 msgpack = require('msgpack-js'); | |
var unirest = require('unirest'); | |
var http = require('http'); | |
var net = require('net'); | |
var clients = {}; | |
var Buffer = require('buffer').Buffer; | |