Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Ismael G Marin C igmarin

🏠
Working from home
View GitHub Profile
@nijicha
nijicha / install_nodejs_and_yarn_homebrew.md
Last active Nov 19, 2020
Install NVM, Node.js, Yarn via Homebrew
View install_nodejs_and_yarn_homebrew.md
@sharathchandramg
sharathchandramg / install-comodo-ssl-cert-for-nginx.md
Last active Mar 9, 2020
Steps to install a Comodo Wildcard certificate with Nginx.
View install-comodo-ssl-cert-for-nginx.md

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

I have used bigrock.in 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
Humoud / spree-models-cheat-sheet.md
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.
View spree-models-cheat-sheet.md
@zenspider
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-
bruno- / easy_rails_deployment_with_capistrano.md
Last active Jul 29, 2020
Easy Rails deployment with Capistrano
View easy_rails_deployment_with_capistrano.md

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
View tdd-and-bdd-notes.md

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

http://cl.ly/RY8x

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
View form.md

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

@jcasimir
jcasimir / exporter.rb
Created Feb 26, 2012
Export ActiveRecord Tables to CSV
View exporter.rb
require 'csv'
class Exporter
DEFAULT_EXPORT_TABLES = [ Invoice, InvoiceItem, Item, Merchant, Transaction, User ]
DESTINATION_FOLDER = "tmp/"
def self.export_tables_to_csv(tables = DEFAULT_EXPORT_TABLES)
tables.each { |klass| export_table_to_csv(klass) }
end
You can’t perform that action at this time.