Skip to content

Instantly share code, notes, and snippets.

View tomardern's full-sized avatar

Tom Ardern tomardern

  • Midnite.com
  • London
View GitHub Profile
@tomardern
tomardern / chunk-promises.ts
Created June 3, 2022 20:28
Chunk Promise Array with Timeout
function chunkPromises(array: Promise<any>[], size: number, delay: number): Promise<any> {
let p: Promise<any> = Promise.resolve();
let results = [];
for (var i = 0; i < array.length; i += size) {
p = p.then(() => i > 0 ? new Promise((r) => setTimeout(r, delay)) : true)
.then(() => Promise.all(array.slice(i, i + size)))
.then((r) => results.push(...r));
}
return p;
}
@tomardern
tomardern / readme.md
Last active April 12, 2022 18:07
SonarQube & Sonar-Scanner on Apple M1

First get the container ID: docker ps (First column is for container ID)

Use the container ID to run: docker inspect <container id> | grep "IPAddress"

In another terminal window:

@tomardern
tomardern / doPost.gs
Created January 7, 2022 11:56
Google Sheets API
function doPost(req) {
var jsonString = req.postData.getDataAsString();
var data = JSON.parse(jsonString);
var sheetId = data.spreadsheetId;
var spreadsheet = SpreadsheetApp.openById(sheetId);
var sheet = spreadsheet.getSheets()[0];
// Get the last row (The one we want to write into)
var rowIndex = sheet.getLastRow() + 1;
@tomardern
tomardern / resize.html
Last active June 14, 2021 21:07
JQuery Resize and Sortable/Drag and Drop
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>jQuery UI Resizable - Constrain resize area</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" />
<link rel="stylesheet" href="/resources/demos/style.css" />
<style>
#container {
@tomardern
tomardern / Dockerfile
Created January 6, 2021 10:12
Cypress Lambda Testing
FROM cypress/browsers:node14.7.0-chrome84
# Install aws-lambda-cpp build dependencies
RUN apt update && \
apt install -y \
ffmpeg \
xvfb \
g++ \
make \
cmake \
@tomardern
tomardern / copy-2.sh
Created November 28, 2020 18:39
Copy dependancies
#!/bin/bash
# Author : Hemanth.HM
# Email : hemanth[dot]hm[at]gmail[dot]com
# License : GNU GPLv3
#
function useage()
{
cat << EOU
Useage: bash $0 <path to the binary> <path to copy the dependencies>
h3,
h6 {
font-family: Raleway, sans-serif;
color: #202020;
}
.make-center,
.partners .partner img {
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
}
@tomardern
tomardern / config.json
Created December 9, 2018 19:46
Pivotal Lanes Config
{
"groups":[
{
"title":"Me",
"projects":[
1965735
],
"lanes":[
{
"title":"Unstarted",
@tomardern
tomardern / gist:78fab37a8790a9ca45caa4ce4f062f23
Created May 26, 2018 14:14
Github SSH Keys for Deployment
1) Generate the key: (no passphase as automated account)
ssh-keygen -t rsa -b 4096 -C "git@github.com"
2) Upload to github deployment keys (the .pub file)
3) git clone git@github.com:{Org}/{Repo}.git
@tomardern
tomardern / package.json
Created April 8, 2018 14:19
Angular + OnChange (Watch) + Pug
{
"name": "ng-tutorial",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"pug:watch": "./node_modules/onchange/cli.js \"./src/app/**/*.pug\" -d 250 -- node node_modules/pug-cli/index.js {{changed}}",
"dev": "f(){ npm run pug:watch & ng serve ;};f",
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod",