Skip to content

Instantly share code, notes, and snippets.

View jshaw's full-sized avatar
🤖
👨‍🎨 👨‍💻

Jordan Shaw jshaw

🤖
👨‍🎨 👨‍💻
View GitHub Profile
@jshaw
jshaw / YouTubeEventHandling.js
Created July 26, 2012 15:30
YouTube Video Playing and Finished Event Handling
var tag = document.createElement('script');
tag.src = "//www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('player', {
height: '254',
width: '451',
@jshaw
jshaw / GLSL-Noise.md
Created May 30, 2019 18:39 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
	return mix(rand(fl), rand(fl + 1.0), fc);
}
@jshaw
jshaw / about.md
Created February 14, 2019 16:57 — forked from mattdesl/about.md
A Browser and Node.js compatible canvas-sketch script for generative and parametric 3D geometry.

Generative Geometry in Browser + Node.js

Here is a script that can be run with canvas-sketch to generate OBJ files from a parametric/algorithmic 3D ThreeJS geometry.

Hitting "Cmd + S" from the canvas-sketch tool will export a PNG and OBJ file of the scene.

If the same script is run from Node, it will simply render the OBJ to stdout, or write to the filename argument if given.

@jshaw
jshaw / js_template.html
Created August 26, 2014 21:26
example javascript templates using underscore.js templating
<!--Example JS template-->
<script type="text/template" id="PastCommunityTemplate">
<img class="pvs-cmy-img" src="<%= thumbnail %>" alt="<%= name %>">
<h3 class="pvs-cmy-title"><%= name %></h3>
<h4 class="pvs-cmy-city">City: <%= city %></h4>
<p class="pvs-cmy-description"><%= summary %></p>
</script>
@jshaw
jshaw / .bashrc
Last active October 22, 2017 23:51
Aliases used in my .bashrc file / tmux.conf tmux.conf references from http://robots.thoughtbot.com/post/2641409235/a-tmux-crash-course
# GIT
alias gs='git status'
alias gpl='git pull'
alias gc='git commit'
alias gp='git push'
alias ga='git add'
# GRUNT
alias gw='grunt watch --force'
alias gb='grunt build --force'
@jshaw
jshaw / smoothing.ino
Last active February 19, 2017 04:40
Arduino Smoothing algorithm
// taken from https://github.com/arduino/Arduino/issues/3934
// its an alternative to: https://www.arduino.cc/en/Tutorial/Smoothing
const int filterWeight = 4; // higher numbers = heavier filtering
const int numReadings = 10;
int average = 0; // the average
void setup() {
// initialize serial communication with computer:
@jshaw
jshaw / json_export_2_csv.js
Last active September 14, 2016 22:09
JSON import + Export CSV for friend
var json2csv = require('json2csv');
var jsonfile = require('jsonfile');
var fs = require('fs');
var fields = ['Body', 'DateCreated', 'timestamp'];
var file = './jsontest_edit.json';
var import_json = "";
jsonfile.readFile(file, function(err, obj) {
console.dir(obj);
import_json = obj;
@jshaw
jshaw / markdown_cheatsheet
Created April 2, 2014 15:47
markdown cheatsheet
# Header 1 #
## Header 2 ##
### Header 3 ### (Hashes on right are optional)
#### Header 4 ####
##### Header 5 #####
## Markdown plus h2 with a custom ID ## {#id-goes-here}
[Link back to H2](#id-goes-here)
This is a paragraph, which is text surrounded by whitespace. Paragraphs can be on one
@jshaw
jshaw / commands
Created May 28, 2013 15:01
terminal command references
Grep
==========
grep -ir "some_string" some_directory
grep -ir --include=*.less "some_string" some_directory

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname