Skip to content

Instantly share code, notes, and snippets.

if [ -z "$(which convert)" ]; then
echo "Imagemagick is not installed, script will not work"
else
find . -type f -regex '\(.*\)\(jpg\|jpeg\|png\|svg\)' -print0 | while read -d $'\0' file
do
if [[ "$file" == *"@"* ]]; then
echo "$file is already converted. skipping"
else
base="${file%.*}"
extension="${file##*.}"
@jerome-nelson
jerome-nelson / PrintLocalesController.m
Created February 29, 2024 16:29 — forked from ncreated/PrintLocalesController.m
List of iOS locales with currency formatting.
//
// PrintLocalesController.m
// NSFormatterTest
//
// Created by Maciek Grzybowski on 02.04.2014.
//
#import "PrintLocalesController.h"
@interface PrintLocalesController ()
@jerome-nelson
jerome-nelson / release-check.ts
Created August 30, 2022 09:23
Lerna Release Check
import { exec } from "child_process";
import { readFile } from "fs";
import { promisify } from "util";
import semverLt from "semver/functions/lt";
import semverClean from "semver/functions/clean";
const execAsync = promisify(exec);
const readFileAsync = promisify(readFile);
/*
@jerome-nelson
jerome-nelson / README.md
Created May 3, 2022 20:01 — forked from roachhd/README.md
Basics of BrainFuck

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

BrainFuck Programming Tutorial by: Katie

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

INTRODUCTION

@jerome-nelson
jerome-nelson / console.assert.js
Created September 7, 2019 18:20
Function override for console.assert function
console.assert = function (condition, message, args) {
const {check, funcCheck} = args;
let isConditionTrue = false;
(() => {
const checks = Array.isArray (condition) ? condition : [condition];
checks.forEach (elem => {
isConditionTrue = check
? elem === check
: funcCheck ? funcCheck (elem) : false;
@jerome-nelson
jerome-nelson / noopClass.ts
Created May 23, 2019 09:54
Function to create empty classes
function noopClass(fnClass, methods?) {
const listOfMethods = Object.getOwnPropertyNames(fnClass.prototype)
.filter(name => name !== "constructor");
const mockClass = () => undefined;
listOfMethods.forEach((method: string) => {
mockClass.prototype[method] = () => undefined;
});
return mockClass;
}
@jerome-nelson
jerome-nelson / fastify-ws typing .ts
Created April 25, 2019 10:51
TypeScript file with definitions for fastify-ws
import { FastifyInstance } from "fastify";
import fastifyPlugin from "fastify-plugin";
import uws from "uws";
import ws from "ws";
export type SocketHandler = typeof uws.Server | typeof ws.Server;
export type AllowedSocketOptions = "ws" | "uws";
export interface IPluginOptions extends fastifyPlugin.PluginOptions {
library: AllowedSocketOptions;
}
@jerome-nelson
jerome-nelson / noSkippedTestsRule.ts
Created April 19, 2019 09:53
TSLint `no-skipped-tests` Custom Rule
import * as Lint from "tslint";
import * as ts from "typescript";
export class Rule extends Lint.Rules.AbstractRule {
static FAILURE_STRING_XIT = "Calls to `xit` should be removed or fixed.";
static FAILURE_STRING_XDESC = "Calls to `xdescribe` should be removed or fixed.";
apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
return this.applyWithFunction(sourceFile, walk);
@jerome-nelson
jerome-nelson / navDropdown.jq.js
Created March 7, 2017 22:41
Sample Code from Vernons Bingo - used to switch between mobile feature menu and desktop feature menu.
/**
* Revision 2
*/
(function($) {
$.widget("netplay.dropdown", {
//Options (Can all be overridden when calling)
options: {
breakpoint: 767,
ajax: false,
@jerome-nelson
jerome-nelson / mobiledropdowncategory.js
Last active January 8, 2016 17:04
Drupal Taxonomy Menu
/**
* Created by jerome.nelson on 11/11/2015.
*/
(function($, window) {
$.fn.mobileCategories = function (options) {
var first_link, settings;
settings = $.extend({
elem: this,
breakpoint: 767,