- https://medium.com/by-vinicius-reis/repository-pattern-n%C3%A3o-precisa-ser-chato-principalmente-com-laravel-d97235b31c7e
- https://medium.com/by-vinicius-reis/laravel-em-profundo-01-wtf-is-service-provider-a9bd817c4a7d
- https://medium.com/by-vinicius-reis/rip-mvc-obitu%C3%A1rio-b4b6e090d2ef
- https://medium.com/by-vinicius-reis/al%C3%A9m-do-mvc-pt-01-qual-o-problema-do-mvc-e615160f1100
- https://medium.com/by-vinicius-reis/al%C3%A9m-do-mvc-pt-02-camadas-a9745d29c8fc
- https://medium.com/by-vinicius-reis/trabalhando-com-servi%C3%A7os-no-javascript-864310cf386c
- https://blog.codecasts.com.br/vue-js-n%C3%A3o-%C3%A9-um-angular-simpificado-6394c18cc689
- https://blog.codecasts.com.br/ecossistema-js-01-plataformas-7a611608b58
- https://blog.codecasts.com.br/ecossistema-javascript-parte-04-transpilers-734f77422316
- https://blog.codecasts.com.br/codecasts-behind-the-curtains-setup-e-ferramentas-1fe58692d8ad
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var httpProxy = require('http-proxy'); | |
var http = require('http'); | |
var https = require('https'); | |
var express = require('express'); | |
var app = express(); | |
app.use(function (req, res, next) { | |
console.log(req); | |
if (req.url === '/') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Directive, Attribute} from '@angular/core'; | |
import {NgModel} from '@angular/common'; | |
@Directive({ | |
selector: '[mask]', | |
host: { | |
'(keyup)': 'onInputChange()' | |
} | |
}) | |
export class Mask { | |
maskPattern: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Injectable} from '@angular/core'; | |
// Declare TabsService as a provider in app.module.ts | |
// Inject TabsService in your class: constructor(public tabs: TabsService){} | |
// Use the this.tabs.hide() or this.tabs.show() methods wherever you want | |
@Injectable() | |
export class TabsService { | |
constructor() {} | |
public hide() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const | |
composeN = (...fs) => x => | |
fs.reduceRight((x, f) => f(x), x) | |
, map = f => xs => | |
xs.map(f) | |
, reduce = f => xs => | |
xs.reduce(f) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Show Me the Evens - Show me the Odds | |
* Diana is learning to count and she just learned the difference between odds and even numbers. | |
* She wants to have some fun, so she picks a random number. | |
* If that number is even, she decides to count all the even numbers up to it starting from 0 up to (but not including) the input. | |
* If not, she decides to count all the odd numbers up to that number starting from 1 (but not including) the input. | |
**/ | |
const counting = (x) => { | |
return arrayFrom(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const criaArrayPrimos = x => | |
criaArray(x) | |
.slice(2) | |
.filter(checaFatores) | |
const criaArray = tamanho => Array.from({ length: tamanho }, (el, index) => index) | |
const checaFatores = n => | |
criaArray(maiorDivisor(n)) | |
.slice(2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const matrix = [[2,4,6,8],[12,14,16,18],[20,24,28,32],[32,34,36,38],[42,44,46,48]]; | |
const exp = matrix[0]; | |
const arrNumbers = matrix.slice(1); | |
const props = [ | |
(number, _i) => (number * exp[_i]), | |
(number, _i) => (number / exp[_i]), | |
(number, _i) => (number - exp[_i]), | |
(number, _i) => (number + exp[_i]) | |
]; | |
const op = (arr, _i) => arr.map(_a => props[_i](_a, _i)); |
Tive uma situação em que precisei recuperar todos os valores de um objeto, mas esse objeto tinha vários níveis.
O que fiz então foi, criar uma recursividade, verificando cada nó do objeto, se o nó fosse o tipo Object, como quase tudo no JS é, a função é novamente chamada entrando em um loop até que todos os nós fossem processados e seus valores armazenados.
O reduce permite um valor inicial, então usando o concat e o valor inicial como um array vazio
OlderNewer