Skip to content

Instantly share code, notes, and snippets.

View FlaviuSim's full-sized avatar

Flaviu Simihaian FlaviuSim

View GitHub Profile
# 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)
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()
$(function() {
//jquery autocomplete
$("#drugs").autocomplete({
source: "/api/get_drugs/",
minLength: 2,
//select: function( event, ui ) {
//console.log( ui.id ?
//"Selected: " + ui.id + " aka " + ui.id :
//"Nothing selected, input was " + this.id );
<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.18/themes/base/jquery-ui.css" type="text/css" media="all" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"></script>
<div class="ui-widget">
<label for="drugs">Drugs: </label>
<input id="drugs">
</div>