Skip to content

Instantly share code, notes, and snippets.

View bbaaxx's full-sized avatar
🍊
Pasele a lo barrido

Ed Mosqueda bbaaxx

🍊
Pasele a lo barrido
View GitHub Profile
@bbaaxx
bbaaxx / IIG-ES6-07.js
Created November 15, 2017 18:43
Code for blog post about iterators iterables and generators with ES6
const someObject = {
a: 1,
perrito: 'Yolodog',
aChar: 'a',
}
someObject[Symbol.iterator] = function() {
let currentKey = 0;
const keys = Object.keys(this);
const { length } = keys;
@bbaaxx
bbaaxx / IIG-ES6-06.js
Created November 15, 2017 18:42
Code for blog post about iterators iterables and generators with ES6
function makeIterator(array) {
let nextIndex = 0;
return {
next: function() {
return nextIndex < array.length ?
{value: array[nextIndex++], done: false} :
{done: true};
}
};
}
@bbaaxx
bbaaxx / IIG-ES6-05.js
Last active November 18, 2017 23:09
Code for blog post about iterators iterables and generators with ES6
const someArray = [2, 4, 8];
for (let n of someArray) { console.log(n); }
// 2
// 4
// 8
@bbaaxx
bbaaxx / IIG-ES6-04.js
Created November 15, 2017 18:40
Code for blog post about iterators iterables and generators with ES6
for (let char of 'yo!') { console.log(char); }
// y
// o
// !
@bbaaxx
bbaaxx / IIG-ES6-03.js
Last active November 18, 2017 23:08
Code for blog post about iterators iterables and generators with ES6
const someArray = [2, 4, 8];
let someArraySquared = [];
for (let n of someArray) {
someArraySquared.push(n * n);
}
console.log(someArray, someArraySquared);
@bbaaxx
bbaaxx / IIG-ES6-02.js
Last active November 18, 2017 23:08
Code for blog post about iterators iterables and generators with ES6
const someArray = [2, 4, 8];
let someArraySquared = someArray.map(x => x * x);
console.log(someArray, someArraySquared); // [2, 4, 8], [4, 16, 64]
@bbaaxx
bbaaxx / IIG-ES6-01.js
Last active November 15, 2017 18:48
Code for blog post about iterators iterables and generators with ES6
const someArray = [2, 4, 8];
let someArraySquared = [];
for (let i = 0; i < someArray.length; i += 1) {
someArraySquared.push(someArray[i] * someArray[i]);
}
console.log(someArray, someArraySquared); // [2, 4, 8], [4, 16, 64]
@bbaaxx
bbaaxx / wtf.js
Created November 7, 2017 08:01 — forked from MichalZalecki/wtf.js
/* VT100 terminal reset (<ESC>c) */
console.log('\033c');
/* numbers comparations */
> '2' == 2
true
> '2' === 2
var html = (function () {/*
<!DOCTYPE html>
<html>
<body>
<h1>Hello, world!</h1>
</body>
</html>
*/}).toString().match(/[^]*\/\*([^]*)\*\/\}$/)[1];
@bbaaxx
bbaaxx / On the console
Created February 17, 2015 18:03
Crash after EnderIo update from EnderIO-1.7.10-2.2.6.317 to EnderIO-1.7.10-2.2.8.349
[11:33:55 ERROR]: Mod Sorting failed.
[11:33:55 ERROR]: Visting node APIContainer{CoFHAPI:1.0}
[11:33:55 ERROR]: Current sorted list : [Dummy Container (BeforeAll) @428726854, Wrapped{mcp}, Wrapped{FML}, Wra
pped{Forge}, Wrapped{Aroma1997Core}, Wrapped{CodeChickenCore}, Wrapped{<CoFH ASM>}, Wrapped{NotEnoughItems}, Wra
pped{Dummy Container (null) @1155340994}, Dummy Container (Before) @804599493]
[11:33:55 ERROR]: Visited set for this node : [Wrapped{Forge}, APIContainer{CoFHAPI|energy:1.7.10R1.0.2}, FMLMod
:BuildCraft|Transport{6.3.6}, FMLMod:BuildCraft|Silicon{6.3.6}, Wrapped{<CoFH ASM>}, APIContainer{CoFHAPI:1.0},
Dummy Container (Before) @804599493, FMLMod:CoFHCore{1.7.10R3.0.0B9}, Wrapped{CodeChickenCore}, Wrapped{FML}, Wr
apped{Aroma1997Core}, Dummy Container (AfterAll) @199153692, FMLMod:BuildCraft|Core{6.3.6}, Dummy Container (Bef
oreAll) @428726854, Wrapped{Dummy Container (null) @1155340994}, Dummy Container (After) @1396579418, FMLMod:add