Skip to content

Instantly share code, notes, and snippets.

View VitorLuizC's full-sized avatar

Vitor L Cavalcanti VitorLuizC

View GitHub Profile
/*
* Returns a new array without items whose property received is duplicated.
*
* @example
* removeDuplicatesByProp([
* {id: 1, name: 'apple'},
* {id: 2, name: 'apple'},
* {id: 3, name: 'orange'}
* ], 'name');
* //=> [{id: 1, name: 'apple'}, {id: 3, name: 'orange'}]
  • interpretada
  • JIT (just-in-time) por causa da v8, tendo em vista as inumeras otimizações e melhorias de um interpretador normal
  • functions as first-class citzens (funções podem ser atribuídas a variáveis e constantes, podem ser retornadas por outras funções, usadas como parâmetros etc)
  • não bloqueante
  • concorrente
  • baseado em prototipos
  • tipagem dinamica
  • multi paradigma (suporta POO, FP, imperativa, declarativa..)
  • roda em diferentes ambientes (navegador, plataforma node...)
  • sincrona

Moving from Ava to Jest


Pros and Cons

Benefits:

  • Locally it has sped up tests from about 40-50 seconds for Ava, to 8-10 for jest
  • On Travis it has cut test runs down about 9-10 minutes
<?php
get_header();
$estrutura = get_estrutura_pesquisa();
?>
<script type="text/javascript">
var _estrutura = <?php echo json_encode($estrutura); ?>;
var can_publish = <?php echo json_encode(posso_publicar()); ?>;
</script>
@VitorLuizC
VitorLuizC / index.ts
Last active March 5, 2019 01:34 — forked from kimamula/Optional.ts
Implementation of Maybe (Optional) in TypeScript.
type None = void | null | undefined;
const isNone = (value: unknown): value is None => {
return value === null || typeof value === 'undefined';
};
const isMaybe = (value: unknown): value is Maybe<any> => {
return !!(value && (value as { _isMaybe?: any })._isMaybe);
};
<script>
import { mask } from 'vue-the-mask'
export default {
name: 'a-input',
props: {
styleContainer: {
type: Object,
default: () => ({ 'width': '100%' })
@VitorLuizC
VitorLuizC / README.md
Last active September 6, 2018 15:03 — forked from jperasmus/compose.js
Compose function that handles both sync and async functions.