Skip to content

Instantly share code, notes, and snippets.

Working from home

Ismael Marin igmarin

Working from home
View GitHub Profile
lummie / custom_time.go
Last active Oct 15, 2021
Golang custom date / time formats when marshalling to JSON
View custom_time.go
// CustomTime provides an example of how to declare a new time Type with a custom formatter.
// Note that time.Time methods are not available, if needed you can add and cast like the String method does
// Otherwise, only use in the json struct at marshal/unmarshal time.
type CustomTime time.Time
const ctLayout = "2006-01-02 15:04:05 Z07:00"
// UnmarshalJSON Parses the json string in the custom format
func (ct *CustomTime) UnmarshalJSON(b []byte) (err error) {
nijicha /
Last active Nov 13, 2021
Install NVM, Node.js, Yarn via Homebrew
sharathchandramg /
Last active Mar 9, 2020
Steps to install a Comodo Wildcard certificate with Nginx.

The steps below show how to install comodo certificate on centos7.

I have used for the domain registration and procuring the certificates

Create a certificate request

  1. Create a folder to put all our ssl certificates

     mkdir /etc/nginx/ssl/c2r_com
     cd /etc/nginx/ssl/c2r_com
Humoud /
Last active Dec 29, 2019
A cheat sheet for the models of Spree. Spree is a complete open source e-commerce solution for Ruby on Rails.
zenspider / unit.rb
Created Nov 12, 2015
the original minitest impl
View unit.rb
# Totally minimal (hopefully) drop-in replacement for test/unit
# TODO: document minimal core methods needed for this to work
at_exit { Test::Unit.autotest }
module Test
class Assertion < Exception; end
bruno- /
Last active Aug 30, 2021
Easy Rails deployment with Capistrano

Goals of this tutorial:

  • deploy a new Rails app with capistrano
  • make it fast (total process takes less than 5 minutes)
  • make it simple (no unecessary config)
  • manual ssh to the server not required

Rails application stack:

  • nginx
  • unicorn
  • postgresql
View ticket.rb
class Ticket < ActiveRecord::Base
belongs_to :grouper
belongs_to :user
validate :user_cant_be_blacklisted, on: :confirmation
validate :user_cant_double_book, on: :confirmation
validate :grouper_cant_be_full, on: :confirmation
validate :grouper_cant_have_occurred, on: :confirmation

What is a unit in TDD - a unit of work. A use-case in the system.

3 options for a unit of work:

  • Return Value / Exception
  • Noticable State Change (adding a user for example)
  • 3rd Party Call (only place to use mock objects?)

More than just testing the implementation of the code that you're writing, or

View rake_routes_output.txt
posts GET /posts(.:format) posts#index
POST /posts(.:format) posts#create
new_post GET /posts/new(.:format) posts#new
edit_post GET /posts/:id/edit(.:format) posts#edit
post GET /posts/:id(.:format) posts#show
PUT /posts/:id(.:format) posts#update
DELETE /posts/:id(.:format) posts#destroy

Remove me from this list and please don't contact me again by any means. That means don't e-mail me, don't call me, don't find me at conferences, don't send carrier pigeons to my house with small notes attached to their feet, don't even wave to me in the street if you see me. I'll snub you right there in public and that will be really awkward for you. I can't be held responsible if your friends don't talk to you anymore after that. And no, I don't care how great your position supposedly is, what technology it's using, where it's at, how many celebrities are invested, how close they are to closing funding, how much equity they're offering, how many times Paul Graham has high-fived the founders, how close they are to the Mission in San Francisco, how much the position is paying, how great the company is, who claims they know me that works there, how big their signing bonus is, or who I'll supposedly be working for/with. I'm not interested.

Just once more to be totally clear: don't contact me again. At al