Skip to content

Instantly share code, notes, and snippets.

Avatar
🏆
Refactoring

Darren Mothersele darrenmothersele

🏆
Refactoring
View GitHub Profile
@darrenmothersele
darrenmothersele / CustomOscillator.h
Created Jan 26, 2021
JUCE Oscillator using Faust DSP
View CustomOscillator.h
#pragma once
#include "unit2.h"
template <typename Type>
class CustomOscillator
{
public:
CustomOscillator() = default;
View Rename Repo 'Master' Branch
# Steps for renaming your master branch to 'main'
# Adapted from
# https://dev.to/rhymu8354/git-renaming-the-master-branch-137b
# https://www.hanselman.com/blog/EasilyRenameYourGitDefaultBranchFromMasterToMain.aspx
#---------------------------------------------------------------------------------------------#
# A) - Steps if you have no remote / upstream
# B) - Steps if you are the repo owner and have a remote / upstream
# C) - Steps if you are using a repo where the upstream main branch has been renamed
View gist:d3d3b9a7a38b5bfd18a160c35d989555
toPairs(data.employees)[*].merge([1], {
id: [0],
fullName: join(' ', [[1].firstname, [1].surname]),
reverseName: join(', ', [[1].surname, [1].firstname]),
reportsTo: [1].manager && merge(get($.data.employees, [1].manager), { id: [1].manager })
})
View culturebanked.json
[{"blocks":[{"type":"init"},{"type":"gsheet","simple":true,"key":"https://docs.google.com/spreadsheets/d/1YIQCavPvOzTArBc1d2dlbP3bhHVHI65o3-AEHp_urXA/"},{"type":"grid","gridOptions":{}}],"id":"artWillList","workflowId":"artWillList","adapterName":"culturebanked","created":"2020-06-25T09:18:49.829Z","updated":"2020-06-25T09:18:49.829Z","modified":"2020-06-25T09:18:49.829Z","title":"Art"},{"blocks":[{"type":"form","jsonSchema":{"type":"object","properties":{"asset":{"type":"string","title":"Asset"},"width":{"type":"number","title":"Width (mm)"},"height":{"type":"number","title":"Height (mm)"},"medium":{"type":"string","title":"Medium"},"after":{"type":"string","title":"After"},"location":{"type":"string","title":"Location"},"owner":{"title":"Owner","type":"object","properties":{"name":{"type":"string","title":"Name"},"split":{"type":"number","title":"Split"}}},"beneficiaries":{"title":"Beneficiaries","type":"array","items":{"type":"object","properties":{"name":{"type":"string","title":"Name"},"split":{"type":"n
View covidDashboard.json
{
"title": "Coronavirus Dashboard",
"blocks": [
{
"type": "multi",
"batches": [
{
"blocks": [
{
"type": "init"
View coronavirus-dashboard-config.json
{
"title": "Coronavirus Dashboard",
"blocks": [
{
"type": "multi",
"batches": [
{
"blocks": [
{
"type": "init"
View publish.md

Publishing

The prepublish hook will ensure dist files are created before publishing. This way you don't need to commit them in your repository.

# Bump the version first
# It'll also commit it and create a tag
npm version patch -m 'MESSAGE'
@darrenmothersele
darrenmothersele / 001-setup.md
Created Feb 21, 2020
Setup for a Vue CLI project
View 001-setup.md

1. Create project

npm install -g @vue/cli
vue create project-name

Manually select features:

  • Babel
  • Router
  • Vuex
@darrenmothersele
darrenmothersele / download-file.ts
Created Feb 12, 2020
Download a file in JavaScript/TypeScript (click handler for a button)
View download-file.ts
import * as stringify from 'json-stringify-safe';
const format = 'json';
const outputData = stringify(this.model);
const mimeTypes = {
'json': 'application/json',
'csv': 'text/csv',
'xml': 'text/xml',
'txt': 'text/plain'
@darrenmothersele
darrenmothersele / unsplash.md
Created Jan 17, 2020
Unsplash Face detection
View unsplash.md

Adding params for face detection:

&auto=format&fit=facearea&h=256&w=256&q=80&facepad=2