Skip to content

Instantly share code, notes, and snippets.

View eliashussary's full-sized avatar
🍊

Elias Hussary eliashussary

🍊
  • Toronto, Canada
  • 19:21 (UTC -04:00)
View GitHub Profile
@eliashussary
eliashussary / action.yml
Created March 17, 2021 17:30
Yarn v2 workspaces changeset publish workaround
# .github/actions/yarn-changeset-publish/action.yml
name: "Yarn Changeset Publish"
description: "Creates release tags from changesets"
outputs:
published:
description: "The published state"
runs:
using: "node12"
main: "index.js"
@eliashussary
eliashussary / promiseAllMap.ts
Last active December 31, 2020 02:21
promiseAllMap will concurrently resolve a dictionary/map of functions returning promises using `Promise.all`
type PromiseCreator<T = any> = (() => Promise<T>) | Promise<T>;
type PromiseCreatorMap<T> = {
[P in keyof T]: PromiseCreator<T[P]>;
};
type ResolvedPromiseMap<T> = {
[P in keyof T]: T[P];
};
@eliashussary
eliashussary / getAuthToken.http
Created October 9, 2020 00:11
Get _authToken from artifactory
PUT https://<ARTIFACTORYURL>/api/npm/npm/-/user/org.couchdb.user:<USER>
Content-Type: application/json
{
"_id": "org.couchdb.user:<USER>",
"name": "<USER>",
"password": "<APIKEY>",
"type": "user",
"roles": [],
"date": "2020-10-09T00:04:22.579Z"
// This file was initially generated by Windows Terminal 0.11.1251.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
@eliashussary
eliashussary / background.js
Last active February 26, 2024 18:52
chrome webrequest onBeforeRequest example
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Simple extension to replace lolcat images from
// http://icanhascheezburger.com/ with loldog images instead.
chrome.webRequest.onBeforeRequest.addListener(
function(info) {
console.log("Cat intercepted: " + info.url);
@eliashussary
eliashussary / metabase-postgres.docker-compose.yml
Created December 11, 2018 16:45
A docker-compose file for metabase with postgres.
version: "3"
services:
postgres-db:
image: postgres
restart: always
ports:
- 5432:5432
environment:
POSTGRES_PASSWORD: postgres
@eliashussary
eliashussary / scpbak.sh
Created September 14, 2018 15:29
A simple shell script to transfer files to a remote server, followed by adding a suffix to transfered files to mark it as complete.
#!/bin/bash
# ====================================================================================
#
# Title:
# scpbak.sh
#
# Description:
# A simple shell script to transfer files to a remote server,
# followed by adding a suffix to transfered files to mark it as complete.
#
@eliashussary
eliashussary / camelCase to snake_case postgres.sql
Created August 19, 2018 15:41
Script to generate alter statements for renaming table columns from camelCase to snake_case.
WITH from_table AS (
SELECT unnest(array[
-- tables go here
-- start
'bookSessions',
'bookTimeslots',
'bookUnits',
'carts',
'errorLogs',
@eliashussary
eliashussary / 1-Store.js
Last active June 27, 2018 20:21
A proof of concept for a simple React state management tool using the Context API.
/**
* Title: Simple React State Management with Context
* Description:
* This is a React State Management proof of concept which uses the React ^16 Context API.
* This POC is loosely based on redux, with the ommission of reducers to limit the amount of boilerplate required.
*
* ---
* Author: Elias Hussary <eliashussary@gmail.com>
* Created: 2018-06-07
* Updated: 2018-06-07
// paste in chrome console.
let answers = Array.prototype.slice
.call(
document.querySelectorAll(
"table > tbody > tr > td > table > tbody > tr > td:nth-child(2)[valign='top'] > div > span.correctAnswerFlag"
)
)
.reduce((acc, n) => {
const node = n.parentNode.children[2]