Skip to content

Instantly share code, notes, and snippets.

View suissa's full-sized avatar
🏠
Working from home

Jean Carlo Nascimento suissa

🏠
Working from home
  • Suissa Corp
  • Brasil
View GitHub Profile
const compose = (...fns ) => fns.reduce( ( f, g ) => (...args ) => f( g(...args ) ) )
@callmeloureiro
callmeloureiro / comoSerChatoNoWhatsapp.js
Last active January 15, 2024 20:44
Como fazer alguém te responder no whatsapp
/*
Hoje iremos MUDAR a vida da pessoa que não te responde no whatsappp...
Que tal enviar mensagens pra ela até obter uma resposta?!
Sensacional não acha?! Mas, somos devs, correto?! Então vamos automatizar esse paranauê!
Para utilizar:
- Abra o web.whatsapp.com;
- Selecione a conversa que você quer;
- Abra o console e cole o código que está no gist;
@fdaciuk
fdaciuk / Create Reducer.md
Created September 17, 2017 00:38
Less boilerplate when create a new reducer on Redux

Create Reducer

Less boilerplate when create a new reducer on Redux

Method:

'use strict'

const createReducer = (initialState, actionHandlers) => {
@jeyziel
jeyziel / desafio.js
Created September 4, 2017 00:15
Desafio da divisão
const add = ( x ) => ( y ) => x + y
const divide = ( x ) => ( y ) => {
let multiplyfor10 = 0;
const multiply10 = add(10)
const decrement1 = add(-1)
const addFinal = add(0.1)
const decrementY = add(-y)
@lubien
lubien / 1. intro.md
Last active January 7, 2020 00:16
Cond

Create a cond function that takes 2 arguments:

  1. An matrix in the format:
[
  [firstCondition, firstCallback],
  [secondCondition, secondCallback],
  ...
]
@matheustp
matheustp / validarTituloEleitor.js
Last active October 31, 2017 18:46
Código de validação do titulo de eleitor extraído do site do TSE
const getDataFromInscricao = ( inscricao ) => [
inscricao.substr( inscricao.length - 2, 2 ),
inscricao.substr( inscricao.length - 4, 2 ),
inscricao.substr( 0, inscricao.length - 2 )
]
const calcSum1 = ( titulo ) =>
titulo.substr( 0, 8 ).split( '' ).reduce( ( total, val, i ) => total += val * ( 9 - i ), 0 )
const fixDigit = ( exce ) => ( dig ) =>
//Mais simples possível
fun isPrime(num:Int) :Boolean {
if ((num % 2) == 0 && num !== 2 || num == 1) {
print("Não é primo")
return false
}
@Woodsphreaker
Woodsphreaker / pairwise.js
Last active June 30, 2017 20:59
Pairwise
const pairwise = (arr, arg) =>
/*
Primeiro laço (reduce) com os numeros recebidos no array
Inicio o reduce com um array contendo 2 posições, um número inteiro que vai armazenar as somas dos indices e um
objeto que vai armazenar os indices já usados no processo
*/
arr.reduce((acc, cur, indexR, arr) => {
/*
Segundo laço (forEach) para testar o valor recebido do reduce com cada valor do array com a finalizade de
satisfazer a condição do desafio
@seriyps
seriyps / uptime.erl
Last active April 29, 2022 08:38
Uptime of Erlang node
-export([uptime/0, uptime/1, uptime_string/0]).
%% @doc uptime in native time units
uptime() ->
erlang:monotonic_time() - erlang:system_info(start_time).
%% @doc uptime in specified time units
uptime(Unit) ->
erlang:convert_time_unit(uptime(), native, Unit).
@lubien
lubien / imap.js
Last active June 23, 2017 19:56
Proof of concept that you can map multiple functions with only one iteration in JavaScript using iterators (like in Python). Run https://repl.it/Izou/2
/*
* imap lazily maps an interable.
* @param fn Map function
* @param iterableOrIterator Either an iterable or an iterator
*
* It works by always returning a new iterator so that
* you can chain other imaps without loopin once more
* over the same array!
*
* Since iterables are returned, to start the real mapping