Skip to content

Instantly share code, notes, and snippets.

Avatar
🤯
Focusing

neptuno alejandrolechuga

🤯
Focusing
View GitHub Profile
View red-hue-collection.json
{
"_type":"collection",
"id":"102454",
"href":"https://discover.huluqa.com/content/v5/view_hubs/home/collections/102454?is_fallback=true&schema=0&personalized_layout_id=H4sIAAAAAAAAAMu1MjIwMjAEAiNDA4OakmIrQzMDU0MjCxMDA0MzIwBQBVmNHwAAAA==",
"p13n_href":"https://discover.huluqa.com/content/v5/me/state?schema=0&eab_ids=EAB::3c23c44c-7065-4c4e-9b83-822f150eabeb::60390994::1805285,EAB::dbd1a1ab-3622-4a41-983d-c3890aee7874::NULL::NULL,EAB::b306a9c9-7696-43c1-905e-8995519b9b42::NULL::NULL,EAB::62d9ff97-90d9-402b-be0a-47555a7c767b::60610758::6871325,EAB::76437bdb-5dda-4631-a693-f58867b6fd80::60610756::6858294,EAB::cec63bd0-6d33-4516-9aa7-35881365dd35::NULL::NULL&bowie_context=cover_story",
"name":"Red Hue Test",
"theme":"medium_horizontal_details",
"description":"",
"artwork":{
View coalescingOperator.js
/* jshint esnext: true */
// Nullish Coalescing Operator
// operando1 ?? operando2
// operando1 || operando2
class Persona {
constructor(datos) {
this.nombre = datos.nombre;
this.segundoNombre = datos.segundoNombre ?? 'DESCONOCIDO';
this.apellido = datos.apellido;
View lex_hex
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
View format.js
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('-');
}
View gist:ad58e8e3ad834ed0829b20ec6fab1b21
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){
View classA.js
((function (global) {
class A {
constructor() {
console.log('soy clase A');
}
}
global.A = A;
}(this));
View animal.mjs
export class Animal {
constructor(name) {
this.name = name;
}
print() {
console.log(`Soy animal del tipo ${this.name}`);
}
}
export class Oso extends Animal {
View proxy.js
// proxies es6
var empleado = {
nombre: '',
apellido: '',
password: '32ioi4o24'
};
// empleado.nombre = 'alejandro';
@alejandrolechuga
alejandrolechuga / index.html
Created Mar 5, 2019
Generador Infinito Asincrono
View index.html
<!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 Mar 2, 2019
Iterables and iterators
View Example.js
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