Skip to content

Instantly share code, notes, and snippets.

@JetStarBlues
JetStarBlues / p5Workflow.md
Last active February 21, 2022 03:46
p5 Contribution Workflow

Core (p5.js)

Modifying p5 Documentation

  1. Generate a p5.min.js file containing changes via npm run grunt

  2. Add the new p5.min.js file to the docs directory by using ./copyfiles.sh

  3. Steps 1 & 2 can be done as one-liner: npm run grunt && ./copyfiles.sh

@JetStarBlues
JetStarBlues / notes.md
Last active April 26, 2021 19:25
Generating a minimal requirements.txt

Generating a minimal requirements.txt

Option 1 - via pip freeze

  • create a clean virtualenv
  • install only the modules needed to run project
  • run pip freeze to generate a requirements.txt file
    • list of all installed packages and their versions

Option 2 - via pip-compile

  • install pip-tools
@JetStarBlues
JetStarBlues / notes.md
Last active April 26, 2021 19:56
Using virtualenv in Python3

Using virtualenv in Python3

By using virtualenv, can avoid installing modules globally

Installing virtualenv

  • pip install virtualenv

Creating a virtual environment

@JetStarBlues
JetStarBlues / notes.md
Created April 22, 2021 17:57
Keeping a local repo up-to-date with origin

Keeping a local repo up-to-date with origin

  • Switch to main or master branch in local repo
    • git checkout main or git switch main
  • Fetch and merge changes from origin
    • git pull origin main

Sources

@JetStarBlues
JetStarBlues / notes.md
Last active April 9, 2021 16:03
Using a new branch to create pull requests

Using a new branch to create pull requests

Taken from slides from the "Getting Started with Open Source" talk at RC

  1. Fork and clone
  2. Create a new branch
    • git checkout -b branchName
    • or git switch -c branchName ([more info][0])
  3. Do the fix
  4. Commit the changes
@JetStarBlues
JetStarBlues / frag.glsl
Last active February 8, 2024 16:17
Custom attributes (ish) in p5
varying vec3 vVertexColor;
void main ()
{
gl_FragColor = vec4( vVertexColor, 1.0 );
}
@JetStarBlues
JetStarBlues / notes.md
Last active April 16, 2021 19:23
Keeping a fork up to date

Keeping a fork up to date

Attending the "Getting Started with Open Source" talk at RC today, inspired me to finally figure out how to keep forks up-to-date.

Preamble

  • Always make your changes in a branch
    • this way, you can,
      • keep the main branch of the fork in sync with upstream
  • ?
@JetStarBlues
JetStarBlues / writeBinary.py
Created May 10, 2018 20:02
Write a binary file
outputFile = ""
byts = []
with open( outputFile, 'wb' ) as file:
file.write( bytes( byts ) )
@JetStarBlues
JetStarBlues / exportvertices2csv.rb
Last active August 27, 2016 19:42
Modified version of TIG's "Export Vertices to CSV" script for SketchUp. The modifications make the script export vertices from all faces and edges present in the model (nested, unselected, or otherwise) with the relevant group and component level transformations applied. See http://sketchucation.com/forums/viewtopic.php?t=33956
=begin
(c) TIG 2011
http://sketchucation.com/forums/viewtopic.php?t=33956
Type exportvertices2csv in the Ruby Console.
Exports all Vertices is a Selection to a X,Y,Z 'CSV' file.
Edit sep="," if something other than a separating comma is desired e.g. ';'
Make sep="\t" if a TSV file is desired and change ext="csv" to ext="tsv".
It uses the current Model Units/accuracy with the approximate '~ ' and
unit suffix [if any] removed; e.g. change Model Units to 'meters' 3dp to
get exported csv in meters 1.234 - don't use 'fraction' 1' 2 1/2" formats,
@JetStarBlues
JetStarBlues / simpleTimer.py
Created April 16, 2015 14:16
Simple timer
import time
start = time.time()
# call function
elapsedTime = round( ( time.time() - start ), 3 )
print(elapsedTime, "seconds")