Skip to content

Instantly share code, notes, and snippets.

View alejandrolechuga's full-sized avatar
🤯
Focusing

neptuno alejandrolechuga

🤯
Focusing
View GitHub Profile
diff --git a/lexer/src/lib.rs b/lexer/src/lib.rs
index 45d6b38..88495f9 100644
--- a/lexer/src/lib.rs
+++ b/lexer/src/lib.rs
@@ -163,11 +163,22 @@ where I: Iterator<Item = char>,
// matches constructs beginning with a digit, e.g. 0.123 or 10e+42
fn digit(&mut self) -> Result<TokenType, LexError> {
let mut s = String::new();
+ // is digit 0
+ // is the next thing x
function formatNumber(number) {
let format = [];
let num = parseFloat(number);
let decimal = (Math.abs(num) % 1).toString().slice(0,4);
let isNegative = parseInt(num) < 0;
let hasDecimal = number.indexOf('.') !== -1;
if (isNegative) {
format.push('-');
}
class Main {
public static void main(String[] args) {
Main.func("Hello world!");
}
public static void func(String str) {
String output = "";
for (int i = 0; i < str.length(); i++) {
char character = str.charAt(i);
if (output.indexOf(character) == -1){
((function (global) {
class A {
constructor() {
console.log('soy clase A');
}
}
global.A = A;
}(this));
export class Animal {
constructor(name) {
this.name = name;
}
print() {
console.log(`Soy animal del tipo ${this.name}`);
}
}
export class Oso extends Animal {
// mutators
// push , pop, shift, unshift
var array = [];
/
function memoria(limit) {
var array = [];
return function (element) {
var isSet = arguments.length >= 1;
if (isSet) {
array.push(element)
@alejandrolechuga
alejandrolechuga / index.html
Created March 5, 2019 05:06
Generador Infinito Asincrono
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div id="container"></div>
</body>
@alejandrolechuga
alejandrolechuga / Example.js
Last active March 2, 2019 23:24
Iterables and iterators
const arr = ['a', 'b', 'c'];
const iterador = arr[Symbol.iterator]();
iterador.next();
// { value: 'a', done: false }
iterador.next();
// { value: 'b', done: false }
iterador.next();
// { value: undefined, done: true }
/// Only for linear data strutures
(function() {
var CSS_CLASS_DELIM, QuickdrawError, VirtualDomNode, dispatchEvent, exports, qd, qdInternal,
slice = [].slice,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
hasProp = {}.hasOwnProperty;
qd = {};
if (typeof window !== "undefined" && window !== null) {
if (window.qd != null) {
// Promesas (Promises) ES6
// XHR request XMLHttpRequest
// cross domain request
// https://www.mocky.io/
function request(url){
return new Promise((resolve, reject) => {
var xhr = new XMLHttpRequest();
xhr.open('GET', url);