Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View obie's full-sized avatar
🎧
digital nomad making music

Obie Fernandez obie

🎧
digital nomad making music
View GitHub Profile
@obie
obie / designer.html
Created September 6, 2014 00:09
designer
<link rel="import" href="../topeka-elements/category-images.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<polymer-element name="my-element">
<template>
<style>
@obie
obie / gist:25818
Created November 17, 2008 16:39 — forked from patmaddox/gist:25806
When player wins he should be paid 1-1
When player loses, he is not paid
When player has blackjack, he is paid 1.5-1
Scenario: Winning hand with a $50 bet
Given the player has a score of 19
And the dealer has a score of 18
And the player bet $50
When the hand is played
Then the player wins $50
@obie
obie / gist:652092
Created October 28, 2010 19:05
Hashrocket Developer Job Listing (Chicago and Jacksonville, FL)
Hashrocket, the best web design and development company in the universe, is
staffing up its Jacksonville Beach, FL headquarters and Chicago branch office.
This is your chance to consult clients around the world on the coolest projects
alongside an amazingly talented group of peers.
Minimum qualifications:
- Solid communications and client relationship skills
- At least 2 years of Rails programming experience*
- At least 5 years of web development experience
- Demonstrable knowledge of BDD and TDD techiques
@obie
obie / partial_path_override.rb
Created May 11, 2011 16:48
Initializer to tweak auto-generation of partial_path based on rendering objects
# config/initializers/partial_path_override.rb
# Override possibly undesirable naming convention used by Rails to automatically determine
# the path to partial templates when you pass model objects to the render method
# by Obie Fernandez http://blog.obiefernandez.com/content/2011/05/rending-collections-of-heterogeneous-objects-in-rails-1.html
ActionView::Partials::PartialRenderer.class_eval do
private
@obie
obie / gist:1162704
Created August 22, 2011 15:40
adding a counter cache attribute to existing records
class AddCommentsCountToNominations < ActiveRecord::Migration
def self.up
add_column :nominations, :comments_count, :integer, null:false, default: 0
nomination_ids_with_comments = Set.new
Comment.all.each {|c| nomination_ids_with_comments << c.nomination_id}
nomination_ids_with_comments.each do |nomination_id|
Nomination.reset_counters(nomination_id, :comments)
end
end
# See http://blog.obiefernandez.com/content/2012/02/metaprogramming-your-activerecord-objects-at-runtime.html for an explanation
require 'spec_helper'
describe Nomination do
let(:user1) { FactoryGirl.create(:user) }
let(:user2) { FactoryGirl.create(:user_with_nominations_received) }
let(:user3) { FactoryGirl.create(:user_with_nominations_received) }
let(:user4) { FactoryGirl.create(:user) }
let(:user5) { FactoryGirl.create(:user) }
console.log('Loading function');
var doc = require('dynamodb-doc');
var dynamo = new doc.DynamoDB();
/**
* Provide an event that contains the following keys:
*
* - operation: one of the operations in the switch statement below
* - tableName: required for operations that interact with DynamoDB
@obie
obie / source_maps.rb
Last active December 15, 2015 10:39 — forked from alexspeller/source_maps.rb
patches the generated source map with the otherwise missing filename
if Rails.env.development?
module CoffeeScript
class SourceMapError < StandardError; end;
class << self
def compile script, options
script = script.read if script.respond_to?(:read)
if options.key?(:no_wrap) and !options.key?(:bare)
<div class="question">
<div class="q-no">42.&nbsp;&nbsp;</div>
<div class="q-text">When the charge is reversed in a neuron during an action potential it is called</div>
<div class="answers">
<div class="answer">
<span class="answer-hole"></span>
<div class="opt">a)</div>
<div class="option">Polarization</div>
</div>
<div class="answer">
<div class="question">
<div class="q-no">42.&nbsp;&nbsp;</div>
<div class="q-text">When the charge is reversed in a neuron during an action potential it is called</div>
<div class="answers">
<div class="answer">
<span class="answer-hole"></span>
<div class="opt">a)</div>
<div class="option">Polarization</div>
</div>
<div class="answer">