Skip to content

Instantly share code, notes, and snippets.

View matheusazzi's full-sized avatar

Matheus Azzi matheusazzi

View GitHub Profile

This snippets will install:

  • Ruby
  • Homebrew
  • Node
  • Git
  • Databases
  • Some util configs

First of all:

  • Update Mac OS
@matheusazzi
matheusazzi / dispatcher.md
Last active May 12, 2016 19:13
Dispatcher

How Dispatcher Works

We use AMD to organize our code, so we use Almond for this.

This is the dispatcher code:

define('dispatcher', ['jquery'],
  function($) {

This is a variation of BEM/SUIT/RSCSS methodologies.

Utilities

You won't always need utility classes, but if you want to use them, do in this way.

Syntax: u-<utilityName>

.u-utilityName {}

Vendo virado

Em uma caluladora de bolso os dígitos são representados por pequenas barras no visor de cristal líquido:

Quando olhamos com o visor de cabeça para baixo alguns números ainda podem ser lidos (só que com outros valores). Por exemplo, 1995 vira 5661. O quinto número que pode ser lido de cabeça para baixo é 8, e o décimo-quinto é 21, que passa a valer 12 quando é visto de cabeça para baixo.

Você deve responder a pergunta:

@matheusazzi
matheusazzi / promise-observer.js
Last active October 16, 2020 20:11
promise-observer.js
function RenderAndOrderByName() { console.log('Ordenado por nomes') }
function RenderAndOrderByAge() { console.log('Ordenado por idades') }
// Retorna uma Promise
function getUsers() {
// Apenas faz um request para uma lista de users,
// a ordenação é feita no client
}
// Depois que a promise terminar, ordena eles por nome.
@matheusazzi
matheusazzi / button.md
Last active November 27, 2016 03:11
button.md

UI Button Component:

<template>
  <button
    :type="buttonType"
    :class="classes"
    :disabled="isDisabled"
    :autofocus="autofocus"
    @click="action">
# frozen_string_literal: true
class Things::Something
Result = Data.define(:thing, :errors) do
def initialize(thing: nil, errors: [])
super
end
def successful?
errors.empty?
@matheusazzi
matheusazzi / .iex.exs
Created July 16, 2017 22:50
.iex.exs
IEx.configure [
colors: [
pretty: true,
syntax_colors: [
atom: :light_cyan,
string: :light_green,
number: :light_blue,
nil: :light_magenta,
list: :light_white,
tuple: :light_white,
@matheusazzi
matheusazzi / poker.ex
Last active July 20, 2017 17:12
poker.ex
defmodule Poker do
## Rank a poker hand
##
## Card is {:suit, value}, e.g. {:heart, 3}
## Hand is a list of 5 cards
##
## Poker.rank [{:heart, 10}, {:club, 11}, {:heart, 9}, {:diamond, 12}, {:heart, 13}]
## >> :straight
def rank(hand) do
@matheusazzi
matheusazzi / example.clj
Created November 13, 2017 23:25
example.clj
(def tags ["1.0.0" "1.0.1" "1.0.2" "1.1.0" "1.1.2" "1.2.2"])
(defn remove-dots [tag]
(clojure.string/replace tag "." ""))
(defn to-int [s]
(Integer/parseInt s))
(defn between-versions? [n]
(and (> n 101) (< n 120)))