Skip to content

Instantly share code, notes, and snippets.

View raphaelcosta's full-sized avatar

Raphael Costa raphaelcosta

View GitHub Profile
@woloski
woloski / multitenant.md
Last active February 11, 2024 23:14
Multi Tenant Apps in Auth0

Multitenancy refers to a principle in software architecture where a single instance of the software runs on a server, serving multiple client-organizations (tenants)

Let's start by enumerating some multi tenant applications and understand how they handle it.

Slack

Authentication:

@jonathanpenn
jonathanpenn / js.swift
Last active October 25, 2016 11:34
So the JavaScript developers feel right at home...
class NaNClass {}
let NaN = NaNClass()
@infix func == (n1: NaNClass, n2: NaNClass) -> Bool {
return false
}
@infix func != (n1: NaNClass, n2: NaNClass) -> Bool {
return true
}
@rtt
rtt / tinder-api-documentation.md
Last active May 5, 2024 15:28
Tinder API Documentation

Tinder API documentation

Note: this was written in April/May 2014 and the API may has definitely changed since. I have nothing to do with Tinder, nor its API, and I do not offer any support for anything you may build on top of this. Proceed with caution

http://rsty.org/

I've sniffed most of the Tinder API to see how it works. You can use this to create bots (etc) very trivially. Some example python bot code is here -> https://gist.github.com/rtt/5a2e0cfa638c938cca59 (horribly quick and dirty, you've been warned!)

@akitaonrails
akitaonrails / human_gc_stats.rb
Created April 9, 2014 00:17
Just a hack to make it easier to understand GC.stat in Ruby 2.0 and 2.1 (made for a tech talk)
# This is an attempt to translate GC.stat to a more understandable format for humans
# from @samsaffron
# http://samsaffron.com/archive/2013/11/22/demystifying-the-ruby-gc?utm_source=rubyweekly&utm_medium=email
# http://samsaffron.com/archive/2014/04/08/ruby-2-1-garbage-collection-ready-for-production
def gc_stats
stats = GC.stat
space_count = ObjectSpace.count_objects
objects_per_heap = space_count[:TOTAL] / stats[:heap_used]
report = {
@thebucknerlife
thebucknerlife / authentication_with_bcrypt_in_rails_4.md
Last active January 17, 2024 23:54
Simple Authentication in Rail 4 Using Bcrypt

#Simple Authentication with Bcrypt

This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.

The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).

You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault

##Steps

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
@carvalhorafael
carvalhorafael / gist:9398969
Last active September 16, 2020 00:08
Vaga para desenvolvedor Ruby on Rails

Vaga para desenvolvedor Ruby on Rails

Somos um time pequeno, ágil e extremamente focado em entregar o melhor produto para nossos amados clientes. Prezamos pela simplicidade, experiência e usabilidade incríveis.

Acreditamos que um produto excepcional só pode ser construído por um time excepcional e agora estamos em busca de mais um integrante para esse time.

Responsabilidades

Você integrará nosso time e será responsável pela manutenção e desenvolvimento de novas soluções para o Edools.com.

@jmcarp
jmcarp / forceDownload.js
Created March 1, 2014 15:35
Forcing a file download in JavaScript
function forceDownload(href) {
var anchor = document.createElement('a');
anchor.href = href;
anchor.download = href;
document.body.appendChild(anchor);
anchor.click();
}
@thbar
thbar / go_build.rb
Last active March 4, 2017 02:09
Integration testing of a golang app with rspec and capybara-webkit.
module GoBuild
extend self
def build(file)
process = ChildProcess.build('go', 'build', file)
err = Tempfile.new('stderr-spec')
process.io.stderr = err
process.start
process.poll_for_exit(10)
err.rewind