Skip to content

Instantly share code, notes, and snippets.


Hillsie Hillsie

  • Sydney, Australia
View GitHub Profile
Hillsie /
Last active Jul 29, 2022
typing a typescript callback that resolves a promise

Typing a callback that resoles a promise

cb:()=> Promise<void> = () => Promise.resolve();
Hillsie /
Created Dec 30, 2021 — forked from bradtraversy/
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

Hillsie /
Last active Oct 16, 2021
Notes Styling with material-ui v5 and Emotion

Styling with Material-ui V5.0 and Emotion as primary

Material UI

  1. Follow material-ui migration v4 to v5. May require manual upgrade with legacy refactor in future.
  2. As part of the package:
"@emotion/react": "^",
"@emotion/styled": "^",
"@mui/icons-material": "^5.0.1",
"@mui/lab": "^5.0.0-alpha.49",
View rhyming-slang-three.js
function getTranslationMap(rhyme) {
const rhymes = {
"apples and pears": "Stairs",
"hampstead heath": "Teeth",
"loaf of bread": "Head",
"pork pies": "Lies",
"whistle and flute": "Suit",
return rhymes[rhyme.toLowerCase()] ?? "Rhyme not found";
Hillsie / OAuthSignInToTwitterGetTweetCollection.js
Created Dec 31, 2018
Basic OAuth sign in to Twitter and get tweet collection defined in tweetdeck
View OAuthSignInToTwitterGetTweetCollection.js
// OAuth handles the nounce and tokens for you under the hood, but seems like OAuth is nolonger being maintained.
// Works as of 31 Dec 2018, unless I added a typo while obfusicating secrets... think not.
const OAuth = require('oauth').OAuth;
const oauth = new OAuth(
'your application consumer key',
'your application secret',
Hillsie / SignInWithTwitter.js
Created Dec 31, 2018 — forked from rhussmann/SignInWithTwitter.js
Simple 'sign in with Twitter' implementation in node.js
View SignInWithTwitter.js
var http = require('http'),
sys = require('sys'),
URL = require('url'),
querystring = require('querystring'),
OAuth = require('oauth').OAuth;
var oa = new OAuth('',
Hillsie / get-tweet-collection-by-id.js
Created Dec 23, 2018
Twitter API call with native https NodeJS
View get-tweet-collection-by-id.js
const http = require("https");
// prettier-ignore
const options = {
"method": "GET",
"hostname": "",
"port": 443,
"path": "/1.1/collections/entries.json?id=custom-90708098097098-fake",
"headers": {
"authorization":`OAuth oauth_consumer_key="yourtwitterconsumerkey",oauth_token="yourregisteredtwittertoken", oauth_signature_method="HMAC-SHA1",oauth_timestamp="atimestame",oauth_nonce="anonceofyourchoic",oauth_version="1.0",oauth_signature="anoauthtweet"`,
"cache-control": "no-cache"
Hillsie / preventCollectingOwnGA.js
Last active Mar 15, 2020
Prevent Collection of Your Own Google Analytics Results
View preventCollectingOwnGA.js
(function analyticsIFFE(){
const googleTagObj = { hostname :'yourDomainName', gtag: 'UA-XXXXXX-2'};
if (document.location.hostname === googleTagObj.hostname){
const documentHead = document.head;
const scriptTag = document.createElement("script");
scriptTag.async = 1;
scriptTag.src = `${googleTagObj.gtag}`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
Hillsie / gist:127110790882bef277cf113e38acd28b
Last active Oct 18, 2018
Uncomplicated Firewall Rules - ufw
View gist:127110790882bef277cf113e38acd28b
# There are a whole lot more ip's to white list including IPv6
### All the rules
sudo ufw reject in 587
sudo ufw allow from port 587 to port 587
sudo ufw allow from port 587 to port 587
sudo ufw allow from port 587 to port 587
sudo ufw allow from port 587 to port 587
sudo ufw allow from port 587 to port 587
sudo ufw allow from port 587 to port 587
sudo ufw allow from port 587 to port 587