Skip to content

Instantly share code, notes, and snippets.

View geovanisouza92's full-sized avatar
🏠
Working from home

Geo geovanisouza92

🏠
Working from home
View GitHub Profile
@geovanisouza92
geovanisouza92 / Dockerfile
Last active June 23, 2016 12:04
Proxy Reverso simplificado (os '_' nos nomes dos arquivos deveriam ser '/', mas o Gist não suporta subdiretórios :P )
FROM nginx
COPY lb.conf /etc/nginx/conf.d/
@geovanisouza92
geovanisouza92 / problems.md
Created July 10, 2016 16:37
Problems with "xexpr"
@geovanisouza92
geovanisouza92 / main.js
Last active May 6, 2024 05:13
Reactive expression evaluator
import {run} from '@cycle/xstream-run'
import {makeDOMDriver, div, input, button, label} from '@cycle/dom'
import {makeLocalStorageDriver} from 'cyclejs-storage'
import Collection from '@cycle/collection'
import xs from 'xstream'
import debounce from 'xstream/extra/debounce'
import dropRepeats from 'xstream/extra/dropRepeats'
import pairwise from 'xstream/extra/pairwise'
import delay from 'xstream/extra/delay'
import concat from 'xstream/extra/concat'
@geovanisouza92
geovanisouza92 / client.js
Created August 20, 2016 00:18
"Remote" model for Cycle.js
import {run} from '@cycle/xstream-run'
import {makeDOMDriver, div, button} from '@cycle/dom'
import xs from 'xstream'
function main (sources) {
// Intent
const incAction$ = sources.DOM
.select('.inc').events('click')
.mapTo({type: 'INC'})
const decAction$ = sources.DOM
@geovanisouza92
geovanisouza92 / cleanjs.diff
Last active September 3, 2016 05:41
Shared state with reducers
diff --git a/src/shared-state.js b/src/shared-state-cleanjs.js
index f92cbda..92e4c29 100644
--- a/src/shared-state.js
+++ b/src/shared-state-cleanjs.js
@@ -92,6 +92,32 @@ const GuestClicker = sources => isolate(guestClicker)(sources)
const MAX_GUEST = 5
+const stateByFree = ({count}) => state =>
+ ({
@geovanisouza92
geovanisouza92 / flavors.json
Last active October 15, 2016 21:40
create-cycle-app's flavors
[
{
"name": "ES6 (babel) + Browserify",
"value": "cycle-scripts-es-browserify"
},
{
"name": "TypeScript + Browserify",
"value": "cycle-scripts-ts-browserify"
},
{
@geovanisouza92
geovanisouza92 / app.js
Created October 18, 2016 23:00
Shared state between components
import {div, input} from '@cycle/dom'
import isolate from '@cycle/isolate'
import xs from 'xstream'
import {assoc} from 'ramda'
function Form (sources) {
const billingAddressChange$ = sources.DOM
.select('.billing-address').events('input')
.map(ev => ev.target.value)
.startWith('')
  • Há dois tipos de itens: A e B
  • Os items do tipo B podem ser convertidos para A' e A"
  • Dado uma lista com itens A e B (ordem dos itens não é relevante), é necessário gerar o maior número possível de listas-alvo somente com A, A' e A" (substituindo o itens B em A' ou A") dentro do tempo limite t
  • O número de possibilidades únicas é on n é o número de itens B
  • Os itens A não precisam ser modificados, podendo ser reutilizados como lista-alvo inicial (concatenado-se as substituições de B)

Dado a lista inicial (pode ter tamanho arbitrário):

[A, A, B, A, B]

@geovanisouza92
geovanisouza92 / Readme.md
Created November 25, 2016 12:28
Lists generation problem
  • There are two kinds of items: A and B
  • Each item B could be replaced by A' and A"
  • Given a list with items A and B (the order is not important), generate the most quantity of target-lists only with items A, A' and A" below the time limit t
  • Each target-list is sorted after generation, so there isn't necessary to generate each permutation (only replacements are sufficient)
  • The source list have an arbitrary size
  • The number of unique possibilities is where n is the number of B items
  • A items doesn't need to be modified, so it could be reused

Given the source list:

@geovanisouza92
geovanisouza92 / esnextbin.md
Last active November 25, 2016 18:59
esnextbin sketch