Skip to content

Instantly share code, notes, and snippets.

View ChristianRich's full-sized avatar

Christian Rich ChristianRich

View GitHub Profile
@ayyybe
ayyybe / ccdl.command
Last active May 20, 2024 22:48
Adobe Offline Package Builder v0.1.2 (macOS only) --- No longer being maintained.
#!/bin/bash
CYAN="$(tput bold; tput setaf 6)"
RESET="$(tput sgr0)"
clear
if command -v python3 > /dev/null 2>&1; then
if [ $(python3 -c "print('ye')") = "ye" ]; then
clear
@mkuklis
mkuklis / lambda-image-resizer.js
Created July 31, 2018 17:53
AWS Lambda for image resizing with sharp
const sharp = require('sharp');
const aws = require('aws-sdk');
const s3 = new aws.S3();
const Bucket = "BucketName";
const transforms = [
{ name: 'small', size: 85 },
{ name: 'medium', size: 160 },
{ name: 'large', size: 250 },
];
@asw001
asw001 / gist:4f88be045277e935b7d72ff4e17d9460
Created May 3, 2017 03:06
scope, hoisting, side-effects
What is scope? Your explanation should include the idea of global vs. local scope.
Scope refers to the conditions under which a JavaScript program can access variables. There are two
types of scope in ECMAscript version 5: local and global.
Global variables are globally accessible, which means that they are accessible anywhere within a program. Contrasted
with global variables, local variables are accessible only within a function.
Variable precedence begins with local variables, located in functions, then moves outward to global variables contained
in the larger program; the implications of this are that if a variable were to be declared inside and outside of function,
@pauldwhitman
pauldwhitman / excelStampDutyNewSouthWalesAustralia-LongForm
Last active October 2, 2023 00:11
Microsoft Excel formula for calculating stamp duty in New South Wales (NSW), Australia. Long form edition without "magic numbers".
=ROUND(IF(A1>3000000,(0.0125*14000)+(0.015*(30000-14000))+(0.0175*(80000-30000)+(0.035*(300000-80000)+(0.045*(1000000-300000))))+(0.055*(3000000-1000000))+0.07*(A1-3000000),IF(A1>1000000,(0.0125*14000)+(0.015*(30000-14000))+(0.0175*(80000-30000)+(0.035*(300000-80000)+(0.045*(1000000-300000))))+0.055*(A1-1000000),IF(A1>300000,(0.0125*14000)+(0.015*(30000-14000))+(0.0175*(80000-30000)+(0.035*(300000-80000)))+0.045*(A1-300000),IF(A1>80000,(0.0125*14000)+(0.015*(30000-14000))+(0.0175*(80000-30000))+0.035*(A1-80000),IF(A1>30000,(0.0125*14000)+(0.015*(30000-14000))+0.0175*(A1-30000),IF(A1>14000,(0.0125*14000)+0.015*(A1-14000),A1*0.0125)))))),)
@bisubus
bisubus / ES5-ES6-ES2017-ES2019 omit & pick
Last active April 13, 2024 21:03
ES5/ES6/ES2017/ES2019 omit & pick
@thedewpoint
thedewpoint / resize_and_upload_task.js
Created April 24, 2016 20:04
Image manipulation and upload to S3
/**
* Created by daniel on 9/29/2015.
*/
var AWS = require('aws-sdk');
AWS.config.update({accessKeyId: 'ID', secretAccessKey: 'KEY'});
AWS.config.update({region: 'us-east-1'});
var s3 = new AWS.S3();
var fileType = require('file-type');
var lwip = require('lwip');
var uuid = require('node-uuid');
@DenisIzmaylov
DenisIzmaylov / INSTALLATION.md
Last active April 27, 2023 15:44
OS X 10.11 El Capitan: fresh install with Node.js (io.js) Developer Environment

OS X 10.11 (El Capitan) / Node.js and io.js Developer Environment

Custom recipe to get OS X 10.11 El Capitan running from scratch with useful applications and Node.js Developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after fresh install.

Content

@elad-yosifon
elad-yosifon / sortJSON.js
Last active March 8, 2023 04:39
JSON object sort by key - recursive
/**
* this is a utility.
* should NOT be used in production!
*/
function sortJSON(object) {
if (object instanceof Array) {
for (var i = 0; i < object.length; i++) {
object[i] = sortJSON(object[i]);
}
return object;
@coolaj86
coolaj86 / how-to-publish-to-npm.md
Last active April 2, 2024 20:18
How to publish packages to NPM

Getting Started with NPM (as a developer)

As easy as 1, 2, 3!

Updated:

  • Aug, 08, 2022 update config docs for npm 8+
  • Jul 27, 2021 add private scopes
  • Jul 22, 2021 add dist tags
  • Jun 20, 2021 update for --access=public
  • Sep 07, 2020 update docs for npm version
@goatslacker
goatslacker / seqexec.js
Created June 27, 2011 23:05
Sequentially execute commands NodeJS
#!/usr/bin/env node
/*global require process */
const exec = require('child_process').exec;
/**
Returns a function to be executed
@param cmd {string} the command to run
@param callback {Function} the Function to execute after the command finishes running
*/