Skip to content

Instantly share code, notes, and snippets.

View androide-osorio's full-sized avatar

Andrés Osorio androide-osorio

View GitHub Profile
@androide-osorio
androide-osorio / .babelrc
Last active September 9, 2016 20:12
ES2015 Roadtrip to awesomeness: Modules - How to use ES2015 modules in a project using webpack. It also describes the syntax and rules of module exporting and importing.
{
"presets": [
["es2015", { "modules": false }]
]
}
@androide-osorio
androide-osorio / app.js
Last active September 9, 2016 20:16
ES2015 Roadtrip to awesomeness: Modules and SystemJS - this is a great way to quickly test an idea without having to use Webpack or Browserify. DO NOT USE FOR PRODUCTION CODE!!!
// with systemJS, you can import any npm module
// directly in the browser and use it as you see fit.
// just prepend the module name with 'npm:'
import { sum, kebabCase } from 'npm:lodash'
import { addTax } from './checkout';
const amount = 1500;
const myName = 'Androide Osorio';
console.log('Hi, my name is');
@androide-osorio
androide-osorio / generators.js
Created October 4, 2016 21:36
ES2015 roadtrip to awesomeness: Generators
/**
* ES2015 Generators
*/
// think of ES2015 generators as a new kind of function,
// which may be paused in the middle, one or many times,
// and resumed later, allowing other code to run during these
// periods of pause, and be passed different information
// each time it is started or paused, and respond accordingly
// to create a generator function,
@androide-osorio
androide-osorio / proxies.js
Last active October 13, 2016 16:30
ES2015 Roadtrip to awesomeness - Proxies
/*
* Proxies
*/
/*
* Proxies allow to override the default behavior
* from an object's default operations.
*
* Proxies enable creation of objects with the full range of behaviors available to host objects.
* Can be used for interception, object virtualization, logging/profiling, etc.
*/
@androide-osorio
androide-osorio / machine.js
Last active March 26, 2020 20:21
Generated by XState Viz: https://xstate.js.org/viz
/*
Null events and transient transitions
-----------------------------------------------
It is often useful to identify conditional branching in your machine as a state itself. A state that is designed to determine the next state does not need a specific event sent to trigger the transition. Instead, we can use the "null event" to trigger an immediate, transient transition.
The null event is identified with an event name of an empty string '', and is immediately sent to the state upon entry. We can setup multiple targets with conditionals, or fire off actions to set up a future state with this transient transitions.
*/
const ifAtFirstyouDontSuceed = Machine({
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions