Skip to content

Instantly share code, notes, and snippets.

View FlaviuSim's full-sized avatar

Flaviu Simihaian FlaviuSim

View GitHub Profile
.bundle
db/*.sqlite3
log/*.log
tmp/
doc/api
doc/app
*.swp
*~
.DS_Store
.livereload
VALUE
rb_str_intern(VALUE s)
{
VALUE str = RB_GC_GUARD(s);
ID id;
id = rb_intern_str(str);
return ID2SYM(id);
}
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.+\.rb$})
watch(%r{^config/initializers/.+\.rb$})
watch('Gemfile')
watch('Gemfile.lock')
patients = Patient.create([
{
name: "Boris the Blade",
age: 999,
gender: "MALE",
hpi: "Also known as Boris the bullet dodger",
ethnicity: "WHITE"
},
{
name: "Turkish",
~/Dropbox/projects/chef: knife bootstrap ec2-174-129-78-190.compute-1.amazonaws.com -x ubuntu -i ~/.ec2/closedbracket-ssd.pem
Bootstrapping Chef on ec2-174-129-78-190.compute-1.amazonaws.com
ec2-174-129-78-190.compute-1.amazonaws.com E
ec2-174-129-78-190.compute-1.amazonaws.com :
ec2-174-129-78-190.compute-1.amazonaws.com Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
ec2-174-129-78-190.compute-1.amazonaws.com
ec2-174-129-78-190.compute-1.amazonaws.com E
ec2-174-129-78-190.compute-1.amazonaws.com :
ec2-174-129-78-190.compute-1.amazonaws.com Unable to lock directory /var/lib/apt/lists/
ec2-174-129-78-190.compute-1.amazonaws.com
jQuery('a.add-question').live('click', function(e) {
e.stopPropagation()
e.preventDefault()
var form_el = jQuery(this).parents('form')
var num_questions = form_el.find('.question').length
var new_question_el = form_el.find('.question:last').clone()
new_question_el.appendTo('.questions',form_el).hide().slideDown("fast")
new_question_el.find('label,select,input,textarea').each(function(e) {
var el = jQuery(this)
" easier split window commands
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
from django.db import models
class Drug(model.Model):
rxcui = models.IntegerField()
short_name = models.CharField(max_length=50)
is_brand = models.IntegerField(max_length=1)
import csv
from myproject.main.models import Drug
def load_drugs(file_path):
"this loads the drugs from pipe delimited to my model"
for row in csv.reader(open(file_path), delimiter="|"):
drug = Drug(rxcui=row[0], short_name=row[1], is_brand=row[2])
drug.save()
import csv
from myproject.main.models import Drug
def load_drugs(file_path):
"this loads the drugs from pipe delimited to my model"
reader = csv.reader(open(file_path), delimiter="|")
reader.next() # skip header row
for row in reader:
drug = Drug(rxcui=row[0], short_name=row[1], is_brand=row[2])
drug.save()