Skip to content

Instantly share code, notes, and snippets.

View camilo86's full-sized avatar
๐Ÿš€
lets goooo

Camilo Gonzalez camilo86

๐Ÿš€
lets goooo
View GitHub Profile
[
{
"Activity": "Log",
"ApplicationProtocol": null,
"DestinationIP": "2.2.2.2",
"DestinationPort": null,
"DestinationTranslatedPort": null,
"DeviceAction": "Accept",
"DeviceEventClassID": "Log",
"DeviceName": null,
const helper = (api1, api2) => api().catch(() => api2())
....
In controller:
const api1 = getPoint(...)
const api2 = getPints(...)
const result = await helper(ap1, ap2)

Keybase proof

I hereby claim:

  • I am camilo86 on github.
  • I am camilo86 (https://keybase.io/camilo86) on keybase.
  • I have a public key ASAbT5xYjHtj_mp2ufOlyvH-xRDQoEFQ0wMnfPsTNN5frgo

To claim this, I am signing this object:

storage.clear()
.then(() => console.log("Everything is clean!"))
.catch(e => console.error(e))
storage.get("state")
.then(value => console.log(`State from storage is ${value}`))
.catch(e => console.error(e))
async function example() {
await storage.set("state", "hello world")
}
import { storage } from "std:kv-storage";
storage.set("state", "hello world")
.then(() => console.log("Done storing state"))
.catch(e => console.error(e));
localStorage.setItem("state", JSON.strigify(state))
var state = JSON.parse(localstorage.getItem("state"))
Verifying my Blockstack ID is secured with the address 1Bft8tZDG46DL47kwip7sABwX2MYsXKB1d https://explorer.blockstack.org/address/1Bft8tZDG46DL47kwip7sABwX2MYsXKB1d
@camilo86
camilo86 / getClientIPExample.js
Created March 29, 2018 22:33
Get IP address of request while supporting reverse proxy
var clientIp = null;
if(req.connection.remoteAddress) {
clientIp = req.connection.remoteAddress;
} else {
var clientIpList = req.headers['x-forwarded-for'].split(", ");
clientIp = clientIpList[clientIpList.length - 1];
}