Skip to content

Instantly share code, notes, and snippets.

View lubien's full-sized avatar
💭
Teaching people 🔥🦩 LiveView 🔥🦩

Lubien lubien

💭
Teaching people 🔥🦩 LiveView 🔥🦩
View GitHub Profile
@lubien
lubien / dance.0.gif
Last active June 4, 2019 02:11 — forked from urielfcampos/foo
JoJo
dance.0.gif
const arr = [
{
id: 10,
title: "Test 10",
item: "Item 1"
},
{
id: 10,
title: "Test 10",
item: "Item 2"
import lazyLoadingRoutes from '../../support/lazyLoadingRoutes'
export default lazyLoadingRoutes([
{ path: '/login', component: 'Login', meta: { requiresAuth: false } },
{ path: '/forgotPassword', component: 'ForgotPassword', meta: { requiresAuth: false } },
{ path: '/forgotEmail', component: 'ForgotEmail', meta: { requiresAuth: false } },
{ path: '/createAccount', component: 'CreateAccount', meta: { requiresAuth: false } }
])
@lubien
lubien / service.js
Last active December 3, 2017 16:59 — forked from viniazvd/service.js
module.exports = {
async signup(name, email, password) {
const exists = await models.user.findOne({ where: { email } })
if (exists) {
throw new Error({ error: 'E-mail já existe. Tente se registrar com outro.' })
}
const passwordEncrypted = await hashing(password)
@lubien
lubien / get.js
Last active June 23, 2017 23:43 — forked from kaueDM/get.js
const getAll = userUID =>
database
.ref('user_data')
.child(userUID)
.child('customers')
// exemplo de uso:
getAll(myUserId).on('value', snap => {
const value = snap.val()
@lubien
lubien / example.js
Last active June 23, 2017 23:01 — forked from kaueDM/example.js
Estrutura atual das minhas promises
const create = (userUID, customerObj) => {
const ref = database
.ref('user_data')
.child(userUID)
.child('customers')
.push()
const {key} = ref
return ref.set(customerObj)
function testaPost(){
const url = '/includes/curl2.php'
const data = {
username: 'lubien',
password: '123456',
data: `<?xml version='1.0'?>
<methodCall>
<methodName>RequestServer.GetTableState</methodName>
<params>
<param>
@lubien
lubien / rot13.js
Last active June 11, 2017 06:34 — forked from Woodsphreaker/rot13.js
Rot 13
const CODE_A = 65
const ALPHABET = [...Array.from({"length": 26}).keys()].map(key => String.fromCharCode(CODE_A + key))
const getCharIndex = (letter) => letter.charCodeAt(0) - CODE_A
const findNextChar = (index) => (changeTo) =>
ALPHABET[(index + changeTo) % 26]
const getChar = (char) => (changeTo = 0) => {
return getCharIndex(char) >= 0
? findNextChar(getCharIndex(char))(changeTo)
: char
}
@lubien
lubien / transformPMHourToNormal.js
Last active April 5, 2017 11:18 — forked from suissa/transformPMHourToNormal.js
Transform 12-Hour format to 24 hour. Run: https://repl.it/Gvco/2
const {
pipe, match, drop, head, range, map, identity, add
, equals, last, join, take, ifElse, adjust, always
} = require('ramda')
const leftPad = require('left-pad')
const leftPadZero = size => x => leftPad(x, size, '0')
const clockToFullHours =
pipe(
match(/^(\d{1,2}):(\d{2})(\w{2})$/i)
@lubien
lubien / info.md
Last active March 30, 2017 03:57 — forked from Woodsphreaker/info.md

Recuperar todos os números de um array

Recupera todos arrays e retorna somente um com o valores.

No primeiro método há uma recursividade.

No segundo método, uma conversão para string, split e finalmente converte para um array final de números

Acho que pode ser útil também.