Skip to content

Instantly share code, notes, and snippets.

View ajsaraujo's full-sized avatar
👋

Allan Juan ajsaraujo

👋
View GitHub Profile
@tomhodgins
tomhodgins / various-ways-to-do-async.js
Created April 11, 2020 01:15
A variety of ways to express asynchronous stuff in JS
// In an async IIFE with await
(async () => {
const response = await fetch('http://api.open-notify.org/astros.json')
const json = await response.json()
console.log(json)
})();
// Using .then()
fetch('http://api.open-notify.org/astros.json')
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active February 28, 2025 09:40
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@davidfurlong
davidfurlong / JSON.stringify-replacer-sort-keys.js
Last active February 22, 2025 09:12
JSON.stringify replacer function for having object keys sorted in output (supports deeply nested objects)
// Spec http://www.ecma-international.org/ecma-262/6.0/#sec-json.stringify
const replacer = (key, value) =>
value instanceof Object && !(value instanceof Array) ?
Object.keys(value)
.sort()
.reduce((sorted, key) => {
sorted[key] = value[key];
return sorted
}, {}) :
value;
@nielsutrecht
nielsutrecht / RsaExample.java
Created December 28, 2016 14:13
Example of RSA generation, sign, verify, encryption, decryption and keystores in Java
import javax.crypto.Cipher;
import java.io.InputStream;
import java.security.*;
import java.util.Base64;
import static java.nio.charset.StandardCharsets.UTF_8;
public class RsaExample {
public static KeyPair generateKeyPair() throws Exception {
KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");
@developius
developius / README.md
Last active November 22, 2024 01:35
Setup SSH keys for use with GitHub/GitLab/BitBucket etc