Skip to content

Instantly share code, notes, and snippets.

Jordan Johnson RenaissanceBug

View GitHub Profile
@RenaissanceBug
RenaissanceBug / two-song-player.rkt
Created Apr 6, 2016
Alternating between playing two WAV files using rsound
View two-song-player.rkt
#lang racket
#|
Little audio player to demo switching between recordings with
the rsound library.
Create two .wav files, define your constants MUSIC-DIR, SONG1, SONG2,
and run in DrRacket.
Controls: press 1 to start looping SONG1, 2 to start looping SONG2,
or Esc to kill the audio.
@RenaissanceBug
RenaissanceBug / triangle-colors.rkt
Created Sep 20, 2015
Choosing colors with Racket
View triangle-colors.rkt
#lang racket/base
(require 2htdp/image
lang/posn
racket/match)
;; Given: I've got three colors of paint, and the wall is painted light blue.
(define blue (make-color #x66 #xcc #xff))
(define purple (make-color #x66 #x33 #xff))
(define orange (make-color #xff #xcc #x33))
@RenaissanceBug
RenaissanceBug / circular-function-graphs
Created Jun 8, 2015
Circular graphs of functions in modular arithmetic
View circular-function-graphs
#lang typed/racket/base
#|
Drawing function graphs on a circle, in modular arithmetic.
jmj, 8 June 2015.
See also:
http://stephanainley.com/shapes2/#
http://blog.recursiveprocess.com/2015/04/28/linear-modulus-art/
|#
@RenaissanceBug
RenaissanceBug / solar-system.rkt
Created Dec 7, 2014
Beginner Racket solar-system model
View solar-system.rkt
(require 2htdp/image)
(require 2htdp/universe)
; Sun and background
(define SPACE (rectangle 900 900 "solid" "black"))
(define SUN (star 20 "solid" "gold"))
;Key
; (+ [center of ellipse] (* [determines width/height of ellipse]
; (cos (/ fn [adjusts the speed of rotation])))))
@RenaissanceBug
RenaissanceBug / bezier.rkt
Created Dec 7, 2014
Drawing a Bezier curve in Racket
View bezier.rkt
#lang racket
;; Bezier curve drawing. jmj, 4/22/10.
;; Illustrates using posns to represent 2d locations, and drawing using 2htdp/image library.
;; Test cases removed.
(require 2htdp/image)
(define BG (rectangle 220 150 'solid 'white))
@RenaissanceBug
RenaissanceBug / differentiation.rkt
Created Dec 7, 2014
Functions & derivatives, symbolically
View differentiation.rkt
#lang racket
#|
Symbolic differentiation:
An example of higher-order functions in math. Includes:
* Basic function constructors:
- identity
- constant functions for several small numbers
- power-functions (x^n for given n)
* Functions of functions, or function combinators:
@RenaissanceBug
RenaissanceBug / modular-times-tables.rkt
Created Dec 7, 2014
Generating multiplication tables for modular arithmetic
View modular-times-tables.rkt
#lang racket
#| Generator for times-table images for modular arithmetic.
jmj (jjohnson@kirby.org), 12 Nov 2013
Based on a discussion at the Monterey Bay Area Math Teachers' Circle.
|#
(require 2htdp/image)
You can’t perform that action at this time.