View clamp.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clamp | |
// 10 al 100 | |
// 9 -> 10 | |
// 199 -> 100 | |
// 50 -> 50 | |
// min 5 | |
// max 100 | |
function limitarCompra(numArticulos) { |
View deepGet.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DeepGet | |
let resp = { | |
collection: [ | |
{ | |
name: 'batman', | |
metadata: { | |
rating: 'PG-14', | |
year: 1985 | |
} | |
}, |
View red-hue-collection.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
((function (global) { | |
class A { | |
constructor() { | |
console.log('soy clase A'); | |
} | |
} | |
global.A = A; | |
}(this)); |
View animal.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// proxies es6 | |
var empleado = { | |
nombre: '', | |
apellido: '', | |
password: '32ioi4o24' | |
}; | |
// empleado.nombre = 'alejandro'; |
NewerOlder