Skip to content

Instantly share code, notes, and snippets.

View Viswanathantv's full-sized avatar

Viswanathan Viswanathantv

View GitHub Profile
@Viswanathantv
Viswanathantv / search
Created October 21, 2013 16:24
Search in rails
@Viswanathantv
Viswanathantv / rer
Last active December 26, 2015 03:39
tere
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>>
@Viswanathantv
Viswanathantv / form
Created October 21, 2013 17:03
form
<%= 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 %>
@Viswanathantv
Viswanathantv / diff cal
Created November 27, 2013 16:50
Difficulty calculation
#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;
@Viswanathantv
Viswanathantv / cgminer
Created January 5, 2014 10:39
cgminer
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
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
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: ""
{
"Cube9 Ventures" : {
"Devices" : {
"PL2014000001" : {
"HWVersion" : "0000001",
"ModuleInfo" : "Module info comes here",
"Date Of Installation" : "24/07/2014",
"Controls" : {
@Viswanathantv
Viswanathantv / node
Created July 20, 2014 09:19
implementation in node
var msgpack = require('msgpack-js');
var unirest = require('unirest');
var http = require('http');
var net = require('net');
var clients = {};
var Buffer = require('buffer').Buffer;