Skip to content

Instantly share code, notes, and snippets.

View bhserna's full-sized avatar

Benito Serna bhserna

View GitHub Profile
@bhserna
bhserna / car.hbs
Last active August 29, 2015 14:22
carros
{{model.name}}
@bhserna
bhserna / guide.md
Last active August 29, 2015 14:15
Migrate database from heroku to engine yard

Migrate database from heroku to engine yard

1.- Capture a backup of your database in heroku

$ heroku pgbackups:capture

2.- Save the backup locally

class EventsController < ApplicationController
def create
@event = Event.new(event_params)
if @event.valid_for_creation?
@event.save
redirect_to event_path
else
render :new
end
@bhserna
bhserna / git.markdown
Last active August 29, 2015 14:07
Git training wheels

Esta es una pequeña guía aprenderas lo suficiente de git para integrarte a tu equipo de desarrollo. Esta guía NO pretende enseñarte los detalles del funcionamiento de git, ni cada posible funcionalidad.

¿Que es git?

Git es un programa que ayuda a que la gente pueda escribir software en equipo sin que todos esten trabajando en la misma computadora. Ayuda a que tu y yo podamos estar trabajando en el mismo programa pero tu en tu computadora y yo en la mía, es más tu en tu casa y yo en la mía.

Con git puedes trabajar de muchas formas diferentes pero para que tu y yo, o mas bien tu con tu equipo puedan trabajar juntos tienen que establecer un flujo que todos puedan seguir. Yo te propongo uno que siento que para mi es el más sencillo y aparte es muy fácil seguirlo si usas github.

Instalar git

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Ember.js • TodoMVC</title>
</head>
<body>
<script type="text/x-handlebars" data-template-name="todos">
@bhserna
bhserna / menu.hbs
Created October 23, 2013 22:20
emberjs vs frontend hacks --- emberjs
{{#if currentUser.questionsToAnswer}}
<span class="navbar-menu__badge">
{{currentUser.questionsToAnswerCount}}
</span>
{{/if}}
@bhserna
bhserna / pendingreview.html.erb
Last active December 26, 2015 09:09
emberjs vs my frontend hacks -- sprinkles
<script>
new PendingReviewForm("#trip_<%= trip.id %>", "#pending_review_<%= pending_review.id %>")
</script>
#= require application
#= require_self
#= require fixtures
#= require_tree .
document.write('<div id="ember-testing-container"><div id="ember-testing"></div></div>')
document.write('<style>#ember-testing-container { position: absolute; background: white; bottom: 0; right: 0; width: 640px; height: 384px; overflow: auto; z-index: 9999; border: 1px solid #ccc; } #ember-testing { zoom: 50%; }</style>')
App.rootElement = '#ember-testing'
App.setupForTesting()
<script type="text/x-handlebars" data-template-name="tab">
<ul id="customer-tab">
{{#each tabItem in tabItems}}
<li>
<h3>
{{tabItem.food.name}}
<span><a href="#" {{action "removeFood" tabItem.food}}>x</a></span>
<span>${{money tabItem.total}}</span>
</h3>
</li>
@bhserna
bhserna / where_is_the_app.markdown
Last active December 10, 2015 14:38
This are different examples to do the same thing, "mark a notification as read", and the pros and cons that I see in each example

Where is the app?

This are different examples of doing the same thing, "mark a notification as read", and the pros and cons that I see in each example

1. - Logic in the model

  • The user clicks the notification link
  • The system POSTs to the action "notifications/:id/mark_as_read"
  • The controller calls the method Notification#mark_as_read
  • The model updates the attribute "read" saves the Notification record