Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Joel Wallis Jucá joelwallis

View GitHub Profile
View iife.js
// IIFE - Immediately Invoked Function Expression
(function () {
"use strict"
console.log("I'm inside a private scope!")
})()
View DataFetcher.js
class DataFetcher extends React.Component {
componentWillMount() {
this.setState(this.props.initialState)
this.props.fetcher().then(newState => this.setState(newState))
}
render() {
<TablePage {...this.state} />
}
}
@joelwallis
joelwallis / app.js
Last active Dec 25, 2018 — forked from KingTigre/app.js
PASSPORT & express-session config e models
View app.js
const passport = require("passport");
const { LocalStrategy } = require("passport-local");
const User = require("./models/user");
const Employee = require("./models/employee");
const session = require('express-session');
passport.use(new LocalStrategy(username, password, done) => {
User.findOne({ username })
.then(user => done(null, user && User.isPasswordValid(user, password) ? user : false))
.then(err => done(err))
View Dockerfile
FROM elixir:1.7.4-alpine
LABEL maintainer="Joel Wallis Jucá <joelwallis@gmail.com>"
ENV MIX_ENV prod
WORKDIR /app
COPY . $WORKDIR
RUN mix local.hex --force
View isssue-entity-rewrite.md

This is a discussion issue. Tasks will be defined after this discussion issue is closed.


Currently, our Entity library is pretty simple and primitive. It only supports a single database per program, and there's no distinction between a database and a row. Ideally, we would have a clear distinction between representations of a database, a row, and a collection of rows (eg.: a table), so we could use object-oriented programming to properly represent every single aspect of a database (for now, we'll be focused in databases, collections/tables, and rows/documents).

Below are examples of how I imagine it could be:

Different classes for different representations

View keybase.md

Keybase proof

I hereby claim:

  • I am joelwallis on github.
  • I am joelwallis (https://keybase.io/joelwallis) on keybase.
  • I have a public key ASDEG3poIdSCikhq4hNqxFUAFI-iK30SPf5Dhy8g8BrVnwo

To claim this, I am signing this object:

View downloading-from-aws.js
const aws = require('aws-sdk')
const s3 = new aws.S3({
accessKeyId: '<access-id>',
secretAccessKey: '<access-secret>'
})
s3.getObject({
Bucket: 'joelwallis',
Key: 'joel.json'
}, (err, payload) => {
@joelwallis
joelwallis / maumau-match-calc.js
Created Oct 22, 2017
The worst method possible to process match points
View maumau-match-calc.js
var report = `
Indu 120
Joel 18
Rama 56
--
Joel 52
Indu 14
Rama 46
--
Ido 72
View fake-challenges.js
const FAKE_CHALLENGES = (function () {
const fakeMeAFile = file => ({name: file, content: `<${file}-content>`})
const fakeMeAChallenge = challengeKey => ({
title: challengeKey,
files: ['index.js', 'readme.md', 'test.js'].map(fakeMeAFile)
})
return () => ['hello-world', 'fizz-buzz', 'foo-bar'].map(fakeMeAChallenge)
})()
View MyComponent.js
const TEMPLATE = [
'<div class="MyComponent @classes" @attributes>',
' <p>',
' @message',
' </p>',
'</div>'
].join('\n').concat('\n')
const defaultParams = {
classes: '',
You can’t perform that action at this time.