Skip to content

Instantly share code, notes, and snippets.

💜
Building @elug-ce during lockdown

Joel Jucá joelwallis

💜
Building @elug-ce during lockdown
View GitHub Profile
@joelwallis
joelwallis / twitter_client.ex
Last active May 23, 2020 — forked from allefgomes/twitter_client.ex
Twitter Client in elixir
View twitter_client.ex
defmodule TwitterClient do
use Tesla
@token System.get_env("TWITTER_TOKEN")
plug(Tesla.Middleware.BaseUrl, "https://api.twitter.com")
plug(Tesla.Middleware.DecodeJson)
def get_tweets do
{:ok, response} = make_request()
View case-private-scopes.ex
person = :joel
given_person = :john
case given_person do
^person -> "Hi, Joel!"
person -> "Hi, #{person}!"
end
# => "Hi, john!"
View document-version.ts
type DocumentVersion = {
// CouchDB's own ID system
_id: string;
// Your document history ID - the same across all versions of a document
historyId: string;
// The _id of the ancestor document (undefined if first version)
parentId: string;
View react-components-sample.js
const Option = ({ option, onChange }) => {
return (
<label for="">
<option onChange={onChange} /> {option.title}
</label>
);
};
const Question = ({ question, onSubmit }) => {
return (
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 JohnnyHandy/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:

You can’t perform that action at this time.