Skip to content

Instantly share code, notes, and snippets.

Marcos Neves neves

Block or report user

Report or block neves

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View rent.rb
class RentDaysController < ApplicationController
before_action :set_rent_day, only: [:show, :edit, :update, :destroy]
before_action :authenticate_user!
skip_before_action :verify_authenticity_token
# GET /rent_days
# GET /rent_days.json
def index
@rent_days = RentDay.all
end
View mutate-using-immer.js
import produce from 'immer'
const state = {
activeUserId: 123,
activeSessionIndex: 0,
sessions: {
123: [
{
products: [{ id: 456, name: 'iPhone' }]
}
@neves
neves / RangeInput.js
Created Aug 27, 2019
Test Medium Gist Chrome Extension
View RangeInput.js
export default function RangeInput({value, onChange, ...props}) {
}
@neves
neves / gravatar_service.rb
Last active Jul 23, 2019
functional ruby
View gravatar_service.rb
# frozen_string_literal: true
# original: https://github.com/gitlabhq/gitlabhq/blob/master/app/services/gravatar_service.rb
# Esse módulo pode ser chamado de 3 formas diferentes:
# GravatarService.call('j.doe@gmail.com')
# GravatarService.('j.doe@gmail.com')
# GravatarService['j.doe@gmail.com'] # eu prefiro essa última
module GravatarService
extend self
def call(email, size: nil, scale: 2, username: nil)
View sorting.lab.rb
# frozen_string_literal: true
require 'sqlite3'
require 'active_record'
require 'ap'
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
ActiveRecord::Schema.define do
create_table :todos do |t|
@neves
neves / async-concat.js
Last active Nov 10, 2018
Concatenação de resultado paginado de API
View async-concat.js
/*
Tempo esperado para resolver: 30 minutos
Descrição do problema:
Temos uma função chamada listWithPagination que retorna um array de registros paginados.
A única maneira de conseguir um array com todos os registros,
é fazer requisições sequenciais para cada página, concatenando os resultados.
Descrição da solução:
Criar uma função chamada concatenateResults, que receba como parâmetro a função original
View lubuntu.sh
# softwares basicos
sudo apt install curl synapse
# instalar vscode
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install code
View .firebaserc
{
"projects": {
"default": "default"
}
}
@neves
neves / extensions.json
Last active Apr 23, 2018
VSCode's Settings - Syncing
View extensions.json
[
{
"id": "CoenraadS.bracket-pair-colorizer",
"name": "bracket-pair-colorizer",
"publisher": "CoenraadS",
"version": "1.0.27"
},
{
"id": "GrapeCity.gc-excelviewer",
"name": "gc-excelviewer",
View vscode-shortcuts.md
You can’t perform that action at this time.