Skip to content

Instantly share code, notes, and snippets.

@lukehoban
lukehoban / apigatewaydomain.ts
Last active September 25, 2023 07:41
API Gateway Domain Mapping in Pulumi
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
// The services we want to host on our domain...
const api1 = new aws.apigateway.x.API("api1", {
routes: [
{method: "GET", path: "/", eventHandler: async(ev) => {
return {
statusCode: 200,
body: JSON.stringify({hello: "world"}),
@akexorcist
akexorcist / index.js
Last active November 17, 2022 11:25
Axios post method requesting with x-www-form-urlencoded content type. See https://axios-http.com/docs/urlencoded
const axios = require('axios')
/* ... */
const params = new URLSearchParams()
params.append('name', 'Akexorcist')
params.append('age', '28')
params.append('position', 'Android Developer')
params.append('description', 'birthdate=25-12-1989&favourite=coding%20coding%20and%20coding&company=Nextzy%20Technologies&website=http://www.akexorcist.com/')
params.append('awesome', true)
@joecliff
joecliff / cryptojs_base64_encrypt_decrypt.js
Last active March 11, 2024 08:00
An example of base64 usage in cryptojs
var CryptoJS = require("crypto-js");//replace thie with script tag in browser env
//encrypt
var rawStr = "hello world!";
var wordArray = CryptoJS.enc.Utf8.parse(rawStr);
var base64 = CryptoJS.enc.Base64.stringify(wordArray);
console.log('encrypted:', base64);
//decrypt
var parsedWordArray = CryptoJS.enc.Base64.parse(base64);