B

@bxacosta

Object mutation

NodeJS
2 years ago
incorrect(); correct(); function incorrect() { console.log("**** Wrong way to edit a object prop in a copied array with the spread operator ****") const list = [ { "name": "Angel", "age": 20, },

Interval date validation

Java
2 years ago
import java.time.temporal.ChronoUnit; import java.time.*; import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". class Main { private static final int MIN_DAYS_INTERVAL = 7;

Text match

Java
2 years ago
import java.math.*; import java.text.*; import java.util.*; // The main method must be in a class named "Main". class Main { private static final List<String> excludeList = List.of( "new", "grand",

Elegant pairing function

Java
3 years ago
import java.util.*; import java.lang.*; import java.io.*; // http://szudzik.com/ElegantPairing.pdf class Main { public static void main(String[] args) { var x = 7544; var y = 56328; var z = elegantPair(x, y);

Cantor pairing function

Java
3 years ago
import java.util.*; import java.lang.*; import java.io.*; // https://en.wikipedia.org/wiki/Pairing_function#Cantor_pairing_function class Main { public static void main(String[] args) { var x = 423; var y = 56328; var z = cantorPair(x, y);

Listo to base64

Java
3 years ago
import java.util.*; import java.lang.*; import java.io.*; import java.util.stream.*; // The main method must be in a class named "Main". class Main { public static void main(String[] args) { var datos = Arrays.asList( "1",

encrypt-java

Java
3 years ago
import javax.crypto.*; import javax.crypto.spec.*; import java.nio.charset.*; import java.util.*; public class Main { private static final String KEY = "u12hUPtyGhg5WR3t"; public static void main(String[] args) throws Exception {

encrypt-cs

C#
3 years ago
using System; using System.IO; using System.Text; using System.Security.Cryptography; namespace MyCompiler { class Program { public static string AES_KEY = "f8f44cb92d344a9e94878f7ede9b9340"; public static void Main(string[] args) {

Listas Simples Codigo Libre

Java
4 years ago
import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". class Main { /** * Clase que define los elementos que debe tener un Nodo de la lista. * * @author xavier

string build pairs

Java
4 years ago
import java.util.*; import java.lang.*; import java.io.*; import java.util.stream.*; // The main method must be in a class named "Main". class Main { public static void main(String[] args) { var tests = List.of(new Object[]{2, "and", "or"}, new Object[]{2, "or", "and"}, new Object[]{2, "and", "and"}, new Object[]{3, "and", "or"}, new Object[]{3, "or", "and"}, new Object[]{3, "or", "or"},

Random password generator

PHP
5 years ago
<?php function random_password( $length ) { $alphabets = array( 'BCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz', '0123456789', '!@#$%&*-_+,.' );

ejemplo notas

C++
5 years ago
#include <iostream> #include <vector> using namespace std; vector<float> nota_final(vector<vector<float>> notas); void aprobados_reprobados(vector<float> notas); void calcular_faltante(vector<float> notas, vector<float> repetidos); int main() {