Skip to content

Instantly share code, notes, and snippets.

View nadiemedicejose's full-sized avatar
🤠
Working on Gitlab for a few projects

Jose Estrada nadiemedicejose

🤠
Working on Gitlab for a few projects
View GitHub Profile
@llzes
llzes / byteToHex.js
Created February 11, 2020 19:16
Byte to Hex and Hex to Byte in JavaScript.
const byteToHex = (byte) => {
const key = '0123456789abcdef'
let bytes = new Uint8Array(byte)
let newHex = ''
let currentChar = 0
for (let i=0; i<bytes.length; i++) { // Go over each 8-bit byte
currentChar = (bytes[i] >> 4) // First 4-bits for first hex char
newHex += key[currentChar] // Add first hex char to string
currentChar = (bytes[i] & 15) // Erase first 4-bits, get last 4-bits for second hex char
newHex += key[currentChar] // Add second hex char to string
@akshaymnair
akshaymnair / FB.java
Last active March 15, 2022 20:30
Alphanumeric Sorting in Java, Sort a given String Array in Natural Order
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public class FB {
public static int comparator(String s1, String s2) {
@danieliser
danieliser / es5.js
Last active February 27, 2024 23:11
Convert Hex Color to rgba with opacity
/**
* ECMA2015
*/
function convertHex(hexCode, opacity = 1){
var hex = hexCode.replace('#', '');
if (hex.length === 3) {
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
}
@fmagrosoto
fmagrosoto / Estados de la República
Last active May 27, 2023 21:50
Lista de estados de la República Mexicana en un campo select
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8' />
<title>Lista de Esados de la República Mexicana</title>
</head>
<body>
<h1>Lista de Estados de la República Mexicana</h1>
<label>Estado de la República</label>
<select name="estado">