Skip to content

Instantly share code, notes, and snippets.

@robertomiranda
robertomiranda / refactored.rb
Last active June 22, 2017 12:47 — forked from stevebartholomew/gist:1feab9d6fa5128f618c4
Ruby refactoring exercise
class Array
def to_annotated_xml(root)
output = "<#{root}>"
each do |i|
if i.is_a?(Fixnum)
output << "<number>#{i}</number>"
elsif i.is_a?(String)
if i.match(/@/)
output << "<email>#{i}</email>"

RubyConf Colombia is Back for 2016!

You're more than welcome, encouraged—to go ahead and share the news with your friends and loved ones. In order to make it easier for you, we made this incredible link that you can click on to create a tweet announcing the good news.

What Even Is This?

RubyConf Colombia is our second not-for-profit, community-driven Ruby, Rails and related technologies conference in Medellin, Colombia. The format is two-day conference with a lot of awesome speakers from around the world and locally. The projected attendee number for RubyConf Colombia 2016 is around 250.

More to Come

Keep.Behaviors.Internationalization = Marionette.Behavior.extend({
initialize: function(){
var currentStore = "us";
var currentView = this[ currentStore + "Behavior"];
if(typeof currentView != "undefined"){
$.extend(true, this.prototype, currentView)
}
},
templateHelpers: function(){
class User
include Mongoid::Document
include Tire::Model::Search
include Tire::Model::Callbacks
tire do
mapping do
indexes :nickname
<!DOCTYPE html>
<html>
<head>
<title>BI Express</title>
require File.expand_path(File.dirname(__FILE__) + '/neo')
# Project: Create a Proxy Class
#
# In this assignment, create a proxy class (one is started for you
# below). You should be able to initialize the proxy object with any
# object. Any messages sent to the proxy object should be forwarded
# to the target object. As each message is sent, the proxy should
# record the name of the method sent.
#
@robertomiranda
robertomiranda / chat.rb
Created October 13, 2012 20:15 — forked from rkh/chat.rb
Simple Chat Application using the Sinatra Streaming API
# coding: utf-8
require 'sinatra'
set server: 'thin', connections: []
get '/' do
halt erb(:login) unless params[:user]
erb :chat, locals: { user: params[:user].gsub(/\W/, '') }
end
get '/stream', provides: 'text/event-stream' do
@robertomiranda
robertomiranda / users_controller.rb
Created July 19, 2012 21:47 — forked from guilleiguaran/users_controller.rb
Using attr_accessible: the right way
class UsersController < ApplicationController
include ActiveModel::MassAssignmentSecurity
attr_accessible :name, :age
attr_accessible :name, :age, :admin, :as => :admin
def create
@user = User.create!(user_params)
redirect_to @user
end
@robertomiranda
robertomiranda / elements.md
Created April 27, 2012 18:37 — forked from guilleiguaran/elements.md
Excerpts from The Elements of Programming Style. The source of this compilation is unknown.

The Elements of Programming Style

The following rules of programming style are excerpted from the book "The Elements of Programming Style" by Kernighan and Plauger, published by McGraw Hill. Here is quote from the book: "To paraphrase an observation in The Elements of Style by Strunk and White, the rules of programming style, like those of English, are sometimes broken, even by the best writers. When a rule is broken, however, you will usually find in the program some compensating merit, attained at the cost of the violation. Unless you are certain of doing as well, you will probably do best to follow the rules."

@robertomiranda
robertomiranda / securing_rails_updates.md
Created March 5, 2012 19:15 — forked from peternixey/securing_rails_updates.md
How Homakov hacked GitHub and how to protect your application

##How Homakov hacked GitHub and the line of code that could have prevented it


Please note: THIS ARTICLE IS NOT WRITTEN BY THE GITHUB TEAM or in any way associated with them. It's simply hosted as a Gist because the markdown formatting is excellent and far clearer than anything I could manage on my personal Tumblr at peternixey.com.

If you'd like to follow me on twitter my handle is @peternixey