Skip to content

Instantly share code, notes, and snippets.

View orthodoc's full-sized avatar
🎯
Focusing

Biswajit Dutta Baruah orthodoc

🎯
Focusing
View GitHub Profile
@orthodoc
orthodoc / account.rb
Created February 13, 2014 03:04 — forked from smoil/account.rb
class Account < ActiveRecord::Base
def self.search(name = nil)
# search logic
end
end
-- model
some sort of constant hash:
HASH_NAME = {
0 => "Choose:",
1 => "On-Campus Recruiting - CSO",·
2 => "CSO Staff Referral",
3 => "Faculty Contact",·
4 => "Career Day",·
5 => "CSO Summer Job Listing",·
6 => "Alumni Contact",·
/*
Version: 3.4.5 Timestamp: Mon Nov 4 08:22:42 PST 2013
*/
.select2-container {
margin: 0 0 1rem 0;
position: relative;
vertical-align: middle;
font-family: inherit;
-webkit-appearance: none !important;
font-size: 0.875rem;
def self.read_barcode_from_image path
# Call the barcode reader - and get a response of multiple lines
ls = `/usr/bin/zbarimg '#{path}'`.lines
# Handle a variety of unexpected responses that we have seen and debugged quickly over time
ls = [ls] if ls.is_a?(String)
barcodes = []
return barcodes if ls.nil? || ls == 0
##Userable
module Userable
def self.included(base)
base.has_one :user, :as => :userable, :dependent => :destroy, :autosave => true
base.validate :user_must_be_valid
base.alias_method_chain :user, :autobuild
base.extend ClassMethods
base.define_user_accessors
end