Skip to content

Instantly share code, notes, and snippets.

en 🇩🇪

Hernán Schmidt lagartoflojo

en 🇩🇪
  • Nürnberg, Deutschland
View GitHub Profile
kubectl get rs,secrets -o json --namespace <OLD_NAMESPACE> | jq '.items[].metadata.namespace = "<NEW_NAMESPACE>"' | kubectl create -f -
lagartoflojo / scroll-shadow.css
Created Oct 11, 2017 — forked from tbmiller/scroll-shadow.css
CSS - Google Scroll Shadow
View scroll-shadow.css
Gmail/Google Reader Sidebar Scroll Shadows
Neat effect that mimics the scroll shadows that appear in the GOogle sitde bar and visually cues users to scroll up or down depending on their position.
Credit goes to Lea Verou for this awesome find.
Lea's Talk:
Code Source:
lagartoflojo / service.rb
Created Aug 21, 2017
Dependency Injection example in Ruby
View service.rb
require 'resolv'
class ConferenceDomainsService
def initialize(conference, resolver =
@conference = conference
@resolver = resolver
# Checks if domain correctly points to the hosted version
lagartoflojo /
Created Dec 13, 2016
REST vs. GraphQL - the problems with REST and how GraphQL aims to solve them

TL;DR: REST endpoints cause latency and bandwidth problems. GraphQL aims to solve those issues. At the SCC, we'd like to create a prototype of a GraphQL API.


For a good number of years now, REST (Representational state transfer) has been the most common way of writing web APIs. While there is no "REST standard", the basic idea is that web servers provide access to resources through unique URLs, and those resources can provide hypertext links to other related resources.

REST example

For example, we could access the user David (the resource) through the URL We can operate on that resource by using the HTTP verbs GET, POST, PUT, DELETE, etc. To retrieve the resource's data, we can request GET, and receive some JSON, XML or HTML data structure with David's information in return. In that structure, we might find a link the David's friends at `

lagartoflojo /
Last active Sep 26, 2016
How to get your butt bitten by Rails' try and rspec's allow(x).to receive(:bla)

Why Rails' try() and rspec's allow(x).to receive(:bla) can bite you in the butt:

When actions are taken by superusers, we're supposed to append admin_ to the SystemLog event names. For example: when one of us logs in, there should be a SystemLog with admin_log_in event. When normal users log in, there's a SystemLog with log_in event.

If you check your SystemLog table, you'll see that's not currently true ;) And it hasn't been for quite a while. This is surprising, since all of our SystemLog specs are passing!

Digging deeper, we find self.prefixed_event_name(event_name) in SystemLog, which is supposed to add the admin_ prefix. That method checks if the current_user is an admin with: current_user.try(:admin?). current_user could be nil, which is why we use try here. But guess what: the method User#admin? does not exist! We recently renamed admins to superusers, so the correct call should be current_user.try(:superuser?).

But then, how can our tests be passing??

Ember.Handlebars.helper 'format', (body) ->
body = Handlebars.Utils.escapeExpression(body)
body = body.replace(/\n\r?/g, '<br>')
new Handlebars.SafeString(body)
# Usage: {{format stringWithNewLines}}
lagartoflojo /
Last active Dec 19, 2015
Receta de Torta Tres Leches

Torta Tres Leches


  • 4 huevos separados
  • 1 1/2 taza de harina
  • 1 1/4 taza de azúcar
  • 4 cucharaditas de esencia de vainilla
  • 3 cucharaditas de polvos de hornear
lagartoflojo /
Created Feb 13, 2012 — forked from geddski/nesting.js
Helper function for nesting Backbone collections (CoffeeScript version)
Backbone.Model::nestCollection = (attributeName, nestedCollection) ->
#setup nested references
for item, i in nestedCollection
@attributes[attributeName][i] =
#create empty arrays if none
nestedCollection.bind 'add', (initiative) =>
if !@get(attributeName)
@attributes[attributeName] = []
View Bio.markdown

Hernán empezó a los 16 años a crear sus propias páginas web para entretenerse y por trabajo. En ese entonces, Geocities y Tripod la llevaban, toda página debía tener una intro en Flash (si tenía sonido, mejor aún), y todo webmaster que se respetara diseñaba para Internet Explorer 4.0.

Una vez en la universidad, Hernán descubrió, en su temprana versión 1.2, la plataforma Ruby on Rails para la rápida creación de aplicaciones web, y ha dedicado una gran parte de su tiempo libre en perfeccionarse en su uso. Desde entonces, ha desarrollado sitios para tiendas de música ( y, para una empresa de telecomunicaciones (GTD Manquehue), para una startup (, y para una empresa de asesoría en innovación e incubadora (DictUC).

Actualmente, Hernán está elaborando su memoria, en la cual aplica las últimas tecnologías web en crear una aplicación para el ámbito de la educación y diseñada para dispositivos móviles.