Skip to content

Instantly share code, notes, and snippets.

View souenzzo's full-sized avatar
🚴‍♂️
💨 💨

Enzzo souenzzo

🚴‍♂️
💨 💨
View GitHub Profile
@souenzzo
souenzzo / todo.js
Created March 14, 2018 14:57
Todolist in react native. Works on https://snack.expo.io
import React from 'react';
import { Alert, AsyncStorage, Text, View, Button, Keyboard } from 'react-native';
import { CheckBox, Header, List, ListItem, FormLabel, FormInput } from 'react-native-elements';
const defaultStorage = '@My:key';
const initialState = {
input: '',
count: 0,
dones: true,
deleteds: false,
@souenzzo
souenzzo / core.clj
Last active February 3, 2019 23:44
primeiro hangout da Clojurers https://t.me/clojurebrasil
;; Deve estar em `src/clojurebrasil/core.clj`
;; Execute `lein repl` na pasta do project.clj e tudo deve funcionar
(ns clojurebrasil.core
(:require [datomic.api :as d]
[cheshire.core :as cheshire]
[io.pedestal.http :as http]))
(def schema
[{:db/doc "id do usuário"
@souenzzo
souenzzo / facebook.txt
Last active May 19, 2018 17:38
dns denny/allow list
127.0.0.1 facebook.com
127.0.0.1 m.facebook.com
127.0.0.1 www.facebook.com
127.0.0.1 fb.com
127.0.0.1 connect.facebook.net
@souenzzo
souenzzo / async.js
Created April 14, 2018 12:32
Compare async performance with sync.
const fibsync = n => {
if (n <= 1) return 1
const a = fibsync(n - 1)
const b = fibsync(n - 2)
return a + b
}
const fibasync = async (n) => {
if (n <= 1) return 1
// Programação "OO Tradicional"
const express = require('express')
const app = express()
app.get('/', indexGet)
app.post('/', indexPost)
// Programação "Data Driven"
@souenzzo
souenzzo / datomc-on-js-graal.clj
Created May 23, 2018 02:35
How to access datomic from javascript in graalvm
;; Hello world with clojure + js
;; (import '(org.graalvm.polyglot Context))
(let [polyglot (-> (doto (Context/newBuilder (into-array ["js"]))
(.allowAllAccess true))
(.build))]
(.eval polyglot "js" "
console.log('hello');
"))
@souenzzo
souenzzo / foo.clj
Created May 31, 2018 18:14
desafios do lambda WIP
(defn str->index
[s]
(let [[nodes & edges] (string/split-lines s)
split #(string/split % #",")
nodes (split nodes)]
(reduce (fn [index [node edges]]
(let [ke (zipmap nodes edges)]
(into index (for [[k v] ke
:when (not (string/blank? v))]
[[node k] (bigint v)]))))

Keybase proof

I hereby claim:

  • I am souenzzo on github.
  • I am souenzzo (https://keybase.io/souenzzo) on keybase.
  • I have a public key ASD0ZWrUwMXEiq6v92gweqkx3Bc0RIixtMqfbhEdEdLrMQo

To claim this, I am signing this object:

{ "foo": "bar"
, "var": [ 1
, 2
, 3
]
}
(require '[datomic.api :as d])
(defn undo-transact
[db tx]
(let [ref? (set (d/q '[:find [?ident ...] :where [?e :db/ident ?ident] [?e :db/valueType :db.type/ref]] db))
ident (into {} (d/q '[:find ?id ?ident :where [?id :db/ident ?ident]] db))
hist (d/history db)
data-from-tx (d/q '[:find ?e ?a ?v ?tx ?op
:in $ ?tx
:where