Skip to content

Instantly share code, notes, and snippets.

View mrjoshida's full-sized avatar

Josh Caldwell mrjoshida

View GitHub Profile
@mrjoshida
mrjoshida / Simple_Scratch.user.css
Last active April 13, 2022 12:06
User CSS to simplify the Scratch interface for the creation of instructional animated gifs. Text removed to make gifs useable across languages. This isn't intended to show the creation of specific block stacks, but rather general interactions like navigating the environment. Use with Stylus Chrome extension https://github.com/openstyles/stylus/w…
/* ==UserStyle==
@name Simple Scratch testing
@namespace github.com/openstyles/stylus
@version 1.0.8
@description Stylesheet to remove text and extraneous UI from Scratch. Used for localization-friendly screencasts
@author @mrjoshida
==/UserStyle== */
@namespace xlink 'http://www.w3.org/1999/xlink';
@-moz-document domain("csfirstcoding.withgoogle.com"),
domain("scratch.mit.edu"),
@mrjoshida
mrjoshida / Chapter4_Container_Exemplar.js
Created January 4, 2021 13:53
Exemplar code for the Chapter 4 project Make a Container in the book Coding and the Arts (creativecodingbook.com). Paste into Sonic Pi to run.
cube({size: 1}); // Creates a cube that is 1 x 1 x 1
linear_extrude({height: 1}, square({size: 1})) // Creates a 1 x 1 square and then extrudes it by 1 to create a 1 x 1 x 1 cube
@mrjoshida
mrjoshida / Chapter3_Interval_Exemplar.rb
Created January 3, 2021 21:20
Exemplar code for the Chapter 3 project Scales and Intervals in the book Coding and the Arts (creativecodingbook.com). Paste into Sonic Pi to run.
use_bpm 120
current_note = 60
play(current_note)
sleep(1)
# C Major scale using single variable
current_note = current_note + 2
play(current_note)
@mrjoshida
mrjoshida / Chapter3_Interval_Starter.rb
Created January 3, 2021 21:09
Starter code for the Chapter 3 project Scales and Intervals in the book Coding and the Arts (creativecodingbook.com). Paste into Sonic Pi to run.
use_bpm 120
current_note = 60
play(current_note)
sleep(1)
current_note = current_note + 2
play(current_note)
sleep(1)
@mrjoshida
mrjoshida / Chapter3_Shape_Exemplar.rb
Last active January 3, 2021 21:05
Exemplar code for the Chapter 3 project The Shape of Sounds in the book Coding and the Arts (creativecodingbook.com). Paste into Sonic Pi to run.
use_bpm 120
define :my_sound do |n|
play n,
attack: 0.5,
attack_level: 1,
decay: 0.25,
sustain_level: 0.4,
sustain: 0.75,
release: 0.5
@mrjoshida
mrjoshida / Chapter3_Shape_Exemplar.rb
Last active January 3, 2021 21:05
Starter code for the Chapter 3 project The Shape of Sounds in the book Coding and the Arts (creativecodingbook.com). Paste into Sonic Pi to run.
use_bpm 120
define :my_sound do |n|
play n,
attack: 0.5,
attack_level: 1,
decay: 0.25,
sustain_level: 0.4,
sustain: 0.75,
release: 0.5
@mrjoshida
mrjoshida / walls
Created July 9, 2016 02:52
Commonly used GameLab code snippets
// Create a sprite for each wall and add them to the group walls
// You can then use sprite.bounceOff(walls)
var walls = createGroup();
var top = createSprite(200, 0, 400, 5);
walls.add(top);
var bottom = createSprite(200, 400, 400, 5);
walls.add(bottom);
var left = createSprite(0, 200, 5, 400);
walls.add(left);