Skip to content

Instantly share code, notes, and snippets.

View jgfrancisco's full-sized avatar

Athan Francisco jgfrancisco

View GitHub Profile
@jgfrancisco
jgfrancisco / multiEcho.sh
Last active August 29, 2015 14:20
Golang read from stdoutput
#!/bin/sh
for i in {1..20}
do
echo "This is message $i"
sleep $i
done
@jgfrancisco
jgfrancisco / randString.go
Last active June 27, 2016 09:47
Random String Generator
import (
"math/rand"
)
var chars = []rune(" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890")
func randString(n int) string {
b := make([]rune, n)
for i := range b {
b[i] = chars[rand.Intn(len(chars))]
@jgfrancisco
jgfrancisco / compress.go
Last active November 4, 2021 13:15
compress protobuf
package main
import (
"bytes"
"compress/flate"
"compress/gzip"
"compress/zlib"
"errors"
"fmt"
"io/ioutil"
@jgfrancisco
jgfrancisco / CheckoutVB.vb
Created December 20, 2016 07:57
Checkout creation using VB
Dim byteArray As Byte() = System.Text.Encoding.UTF8.GetBytes("{
""totalAmount"": {
""currency"": ""PHP"",
""value"": ""3210.99""
},
""buyer"": {
""firstName"": ""Visual"",
""lastName"": ""Basic""
},
""items"": [
@jgfrancisco
jgfrancisco / promise_short_circuit.js
Created March 13, 2020 13:35
Promise short circuit behavior
const fn1 = (a, b, x) => new Promise((resolve, reject) => {
if (x) resolve('resolve x');
console.log('after x');
if (a) reject('reject a');
console.log('after a');
if (b) reject('reject b');
console.log('after b');
resolve('resolve c');
});
const fn2 = (a, b, x) => new Promise((resolve, reject) => {