Skip to content

Instantly share code, notes, and snippets.

View gustavo-depaula's full-sized avatar
👨‍🌾
Have you watched Hamilton?

Gustavo de Paula gustavo-depaula

👨‍🌾
Have you watched Hamilton?
  • Comic Sans Global Domination Technology Conglomerate
  • São Paulo
View GitHub Profile
@gustavo-depaula
gustavo-depaula / current-music-lyrics.clj
Last active May 1, 2019 22:05
get my current spotify music lyrics, with clojure
(ns clj-current-music-lyrics.core
(:require [clj-http.client :as client]
[clojure.data.json :as json])
(:gen-class))
(def apikey "Bearer YOUR_API_KEY")
(defn -main
"main fn"
[& args]
@gustavo-depaula
gustavo-depaula / stacks.scm
Created June 5, 2019 04:48
stacks definition in scheme and balanced expression algorithm
;;; Stack structure definition
(define nil '())
(define (stack . items)
(apply list items))
(define (push stack item)
(cons item stack))
(define (pop stack)
@gustavo-depaula
gustavo-depaula / square.scm
Created June 21, 2019 02:10
square scheme
(define (square x) (* x x))
;; (define (square x) (* x x))
;; | | | | | |
;; To square something, multiply it by itself.
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
const signatureMachine = Machine({
id: 'signature',
initial: 'init',
context: {
signature: null,
isExpectedRecipient: null
},
states: {
init: {
on: {
const signatureMachine = Machine({
id: 'signature',
initial: 'init',
context: {
signature: null,
isExpectedRecipient: null
},
states: {
init: {
on: {
const SSTATES = {
loadingStep: 'loadingStep',
successStep: 'successStep',
offlineStep: 'offlineStep',
redirectStep: 'redirectStep'
};
const AACTIONS = {
REDIRECT: 'REDIRECT'
};
const protocolMachine = Machine(
{
id: 'protocol',
initial: 'signature',
context: {
// machine refs
signatureMachineRef: null,
recipientMachineRef: null,
packageSyncMachineRef: null,
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)