Skip to content

Instantly share code, notes, and snippets.

View SimonVanherweghe's full-sized avatar
🍜
Raming

Simon Vanherweghe SimonVanherweghe

🍜
Raming
View GitHub Profile
@SimonVanherweghe
SimonVanherweghe / index.js
Created May 12, 2017 11:13
Array destructuring as object
const arr = [`a`, `b`, `c`];
const {0: first} = arr;
console.log(first);
@SimonVanherweghe
SimonVanherweghe / gist:569f617397a93caad3f309f6a52dd5aa
Created September 10, 2020 14:52
Remove node modules Automator action
Quick action
receive current folder in Finder app
Run Shell Script:
```
find $1 -name "node_modules" -type d -prune -exec rm -rf '{}' +
say "node modules removed"
```
@SimonVanherweghe
SimonVanherweghe / css.json
Created October 21, 2020 14:27
VS Code snippet - Box sizing border box
{
// CMD - SHIFT - P
// 'Configure user snippets'
// 'css'
// copy paste
//
// Place your snippets for css here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
@SimonVanherweghe
SimonVanherweghe / Leho export submission comments.js
Last active December 19, 2022 13:36
Export the submission comments for a Instructure Canvas (Leho) assignment
/*
Run this script in the browser console on the assignment page (ie: https://domain.com/courses/1234/assignments/5678)
From there you can copy the output and parse it with something like https://www.convertcsv.com/json-to-csv.htm
*/
const getSubmissions = async (course_id, assignment_id) => {
const path = getPathFromCurrentUrl();
return fetch(`https://leho-howest.instructure.com/api/v1/${path}/submissions?include[]=submission_comments&per_page=300`).then(r => r.json());
}
@SimonVanherweghe
SimonVanherweghe / generator.sh
Created May 3, 2023 19:17
Logo Banner Generator
# This script will take all the images in the src directory and generate webp images in the out directory.
# - You can specify the width, height and padding
# - Images are centered on the canvas
# - If the filename contains a '-b', the top left pixel color will be used as the background color
# - If the filename contains a '-k', the background color will be black (key color, for my print OG's)
# - If the filename contains '-np', no padding will be added
# - If the filename contains a '-c', the image will be cropped to the center of the canvas
@SimonVanherweghe
SimonVanherweghe / Devine-dev1.code-profile
Created August 31, 2023 13:43
First year development - VS Code setup
{
"name": "Devine-dev1",
"settings": "{\"settings\":\"{\\n \\\"editor.formatOnPaste\\\": true,\\n \\\"editor.formatOnSave\\\": true,\\n \\\"files.autoSave\\\": \\\"afterDelay\\\"\\n}\"}",
"snippets": "{\"snippets\":{\"css.json\":\"{\\n\\t// Place your snippets for css here. Each snippet is defined under a snippet name and has a prefix, body and \\n\\t// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:\\n\\t// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the \\n\\t// same ids are connected.\\n\\t// Example:\\n\\t// \\\"Print to console\\\": {\\n\\t// \\t\\\"prefix\\\": \\\"log\\\",\\n\\t// \\t\\\"body\\\": [\\n\\t// \\t\\t\\\"console.log('$1');\\\",\\n\\t// \\t\\t\\\"$2\\\"\\n\\t// \\t],\\n\\t// \\t\\\"description\\\": \\\"Log output to console\\\"\\n\\t// }\\n\\t\\\"Box Sizing Border box\\\": {\\n\\t\\t\\\"prefix\\\": \\\"bbb\\\",\\n
@SimonVanherweghe
SimonVanherweghe / autodip.vpy
Last active March 20, 2024 10:15
A vpype script to inlcude a dipping pattern in a plotter svg
# The colors available
eval "colorNames = ['red','green','blue','darkbrown','yellow','blue','purple']"
# Position of the colors, assuming they are in a grid (x: column, y: row)
eval "colorPosition = [{'x':0,'y':0},{'x':1,'y':0},{'x':2,'y':0},{'x':3,'y':0},{'x':0,'y':1},{'x':1,'y':1},{'x':2,'y':1}]"
# width en height of the colors, postion of water cup (center), radius of water cup
eval "colorWidth = 15; colorHeight = 20; nStrokes=0; waterX = 150; waterY = 20; waterR=5"
# How much distance can a brush cover before it needs new paint