Skip to content

Instantly share code, notes, and snippets.


Wenbert Del Rosario wenbert

View GitHub Profile
wenbert / Python save image from URL
Created December 29, 2010 06:24
Python save image from URL
View Python save image from URL
import cStringIO # *much* faster than StringIO
import urllib
import Image
file = urllib.urlopen('')
im = cStringIO.StringIO( # constructs a StringIO holding the image
img ='/home/wenbert/uploaderx_files/test.gif')
except IOError, e:
View gist:fc1cb6538b4d9fdb26177574e46faad9
FROM php:7.0-fpm
RUN docker-php-ext-install pdo_mysql
# Install mbstring
RUN docker-php-ext-install mbstring
# Install bcmath
RUN docker-php-ext-install bcmath
# Install mcrypt
View .bash_profile
# ---------------------------------------------------------------------------
# Description: This file holds all my BASH configurations and aliases
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
View gist:4014610
## the Controller
class FormfieldsController extends AppController {
public $helpers = array('Html', 'Form', 'Formfield');
public $components = array('RequestHandler');
public function beforeFilter() {
$this->Security->csrfExpires = '+1 hour';
wenbert /
Created July 25, 2012 01:29 — forked from melanke/
watch the changes of some object or attribute

Watch.js 1.0.13

##compatibility Works with: IE 9+, FF 4+, SF 5+, WebKit, CH 7+, OP 12+, BESEN, Rhino 1.7+ If you want a similar API that works for all browser try MultiGetSet


Watch.JS is a small library that brings a lot of possibilities. Maybe you know the design pattern called "Observer", imagine the possibility of executing some function always that some object changes. Well, already exists other libraries that do this, but with Watch.JS you will not have to change your way to develop. Give a chance to Watch.JS, take a look at the examples and how is simple to embody Watch.JS to your routine.

View controller
# GET /allergies/new
# GET /allergies/new.json
def new
@patient = Patient.find(params[:patient_id])
@allergy =
respond_to do |format|
format.html # new.html.erb
format.json { render json: @allergy }
View gist:1626569
## error
FAIL should create allergy (0.40s)
"Allergy.count" didn't change by 1.
<3> expected but was
## test
test "should create allergy" do
assert_difference('Allergy.count') do
View gist:1626619
class AllergiesControllerTest < ActionController::TestCase
setup do
@allergy = allergies(:allergy_one)
@sample_allergy = {
:name => "allergy_name_sample",
:desc => "allergy_desc_sample",
:patient_id => @allergy.patient_id
View gist:1583321
wenberts-MacBook-Pro-17:md wenbert$ rake test:functionals
Loaded suite /Users/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/rake-
PASS should create allergy (0.23s)
PASS should destroy allergy (0.01s)
PASS should get edit (0.13s)
ERROR should get index (0.05s)
RuntimeError: [#<Allergy id: 298486374, name: "MyString", desc: "MyText", created_at: "2012-01-09 15:07:28", updated_at: "2012-01-09 15:07:28", patient_id: 1>]
View gist:1582890
class AllergiesControllerTest < ActionController::TestCase
setup do
@allergy = allergies(:one)
@allergy.patient = patients(:one)
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:allergies)