Skip to content

Instantly share code, notes, and snippets.

View MarcoWorms's full-sized avatar
:shipit:
undefined

Marco Guaspari Worms MarcoWorms

:shipit:
undefined
View GitHub Profile
body {
background-color: black;
font-family: Lucida Sans Unicode;
color: #ffffff;
}
div {
border: 1px solid black;
}
function pai (carro) {
var comida = 'pizza'
function filho () {
console.log(comida)
function neto () {
console.log(carro)
}
function contador () {
var valor = 0
return {
incrementar: function () {
valor += 1
},
getValor: function () {
return valor
}
@MarcoWorms
MarcoWorms / closure1.js
Last active July 6, 2016 16:49
Closure 1
function pai (umNumero) {
var metadeDoNumero = umNumero / 2
function filho () {
console.log(umNumero)
console.log(metadeDoNumero)
}
filho()
}
// example of what this code would produce => http://worms.io/pocDeclarative
const makePlayer = () => {
return {
initial: {
size: [50, 50],
position: [10, 10],
physics: true
},
//
// Motivations:
//
// * bring accessible functional programming to game development
// * handy and easy default options for quick game prototyping
// * flexibility for advanced game developers
const W = {
getAngle: (pointA, pointB) => null,
emit: (channel, message, data) => null
const Immutable = require('immutable')
const add = (channels, name) => {
return channels.set(name, Immutable.List())
}
const addAction = (channels, name, action) => {
return channels.set(name, channels.get(name).push(action))
}
@MarcoWorms
MarcoWorms / main.js
Last active November 30, 2016 20:31
function createStore() {
var state = {}
return {
getState: function () {
return state
},
setState: function (newState) {
state = newState
}
function renderState (state) {
var html = '<p>' + state.something + '</p>'
document.getElementById('root').innerHTML = html
}
function renderState (state) {
var html = '<p>' + state.something + '</p>'
document.getElementById('root').innerHTML = html
}
function createStore() {
var state = {
something: "olá mundo"
}
renderState(state)