Skip to content

Instantly share code, notes, and snippets.

global vs instance mode

Details:
https://github.com/processing/p5.js/wiki/Global-and-instance-mode

I usually teach with 'global' mode as it is a bit simpler and easier to jump into, but it can encourage poor practices and lead to some headaches.

Here's a few things to be mindful of:

  • Common JavaScript features like cos() and PI become built-in globals, when a student transitions to other ecosystems (e.g. ThreeJS or even just Node.js) they have to re-learn which functions are builtin (e.g. setTimeout) and which are namespaced (Math.PI)
@jedisct1
jedisct1 / lucet-ondemand.md
Last active February 5, 2023 14:07
Run WebAssembly files like standard executable files on Linux, using Lucet

The following instructions require Lucet, although they can be easily adapted to other WebAssembly runtimes.

Save the following script as /opt/lucet/bin/lucet-ondemand:

#! /bin/sh

wasm_file="$1"
if [ -n "$wasm_file" ]; then
  if od -x "$wasm_file" | head -n1 | grep -Fq '0000000 6100 6d73 0001'; then
@mattdesl
mattdesl / about.md
Last active September 29, 2023 20:08
interactive audio sketch

gif-from-tweet

There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.

Dependencies

  • ffmpeg
    • macOS: brew install ffmpeg
    • Ubuntu/Debian: apt install ffmpeg
#![feature(lang_items)]
#![no_std]
#[no_mangle]
pub fn add_one(x: i32) -> i32 {
x + 1
}
// needed for no_std
<!DOCTYPE html>
<html>
<head>
<title>Wasm</title>
</head>
<body>
<script>
(async () => {
/**
// Create tags
var q1 = document.createElement('iframe'),
q2 = document.createElement('iframe'),
q3 = document.createElement('iframe'),
style = document.createElement('style');
// Set attribute
q1.setAttribute('data-s','');
q2.setAttribute('data-s','');
q3.setAttribute('data-s','');
@alirobe
alirobe / reclaimWindows10.ps1
Last active July 3, 2024 09:36
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
@taivare
taivare / Blob That Walks.markdown
Created February 12, 2016 17:50
Blob That Walks

Blob That Walks

Continuing to explore the Web Animations API. Circles animating with the API. Buttons to pause and change playback rate to 2x. Range Slider that shows the current time of the element when paused (can be changed when paused, also).

A Pen by Dan Wilson on CodePen.

License.

@GQAdonis
GQAdonis / Material Compact Login Animation With React.markdown
Created January 3, 2016 17:14
Material Compact Login Animation With React