Skip to content

Instantly share code, notes, and snippets.

View PatrickMurphy's full-sized avatar
🎯
Just updated http://www.patrickmurphy.dev

Patrick Murphy PatrickMurphy

🎯
Just updated http://www.patrickmurphy.dev
View GitHub Profile
@PatrickMurphy
PatrickMurphy / RedditGroups.sql
Last active February 9, 2018 17:46
NFL Arrest SQL WIP
SELECT Reddit_Group_Name, count(distinct Team_name) as team_count, count(1) as arrest_count, count(1)/count(distinct Team_name) as arrest_rate FROM `ArrestDateRedditGroups`
group by Reddit_Group_Name
ORDER BY `arrest_rate` ASC;
SELECT Reddit_Group_Name, count(distinct Team_name) as team_count, count(1) as arrest_count, count(1)/count(distinct Team_name) as arrest_rate FROM `ArrestDateRedditGroups`
group by Reddit_Group_Name
ORDER BY `arrest_rate` DESC;
SELECT Reddit_Group_Name, Team_name, count(1) as arrest_count
FROM `ArrestDateRedditGroups`
@PatrickMurphy
PatrickMurphy / DNA.pde
Created September 25, 2017 19:52
Microbes
class DNA {
float[] _dna;
DNA() {
this._dna = new float[DNACODE.values().length];
}
DNA(DNA d1, DNA d2) {
this._dna = this.mutate(d1._dna, d2._dna);
}
@PatrickMurphy
PatrickMurphy / .htaccess
Created September 19, 2017 16:33
HtAccess Redirect example
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^api/v1/([^/]*)/([^/]*)/([^/]*)$ api/router.php?endpoint=$1&verb=$2&id=$3 [QSA,NC,L]
RewriteRule ^api/v1/([^/]*)/([^/]*)$ api/router.php?endpoint=$1&verb=$2 [QSA,NC,L]
RewriteRule ^api/v1/([^/]*)$ api/router.php?endpoint=$1 [QSA,NC,L]
RewriteCond %{THE_REQUEST} \s/+(sidebar)\.php[\s?] [NC]
RewriteRule ^ /%1 [R=301,L,NE]
@PatrickMurphy
PatrickMurphy / BrownianPoint.pde
Created August 15, 2017 03:23
Brownian Terrain
class BrownianPoint extends PVector {
int mode;
PVector last;
float firstLoad;
BrownianPoint(float x, float y, float load, int mode) {
this.x = x;
this.y = y;
this.z = load;
this.mode = mode;
this.last = PVector.random2D();
class FieldVector {
PVector location;
PVector grid_location;
PVector heading;
FieldVector(PVector loc, PVector grid_loc) {
this(loc, grid_loc, PVector.random2D());
}
FieldVector(PVector loc, PVector grid_loc, PVector heading) {
this.location = loc;
this.grid_location = grid_loc;
@PatrickMurphy
PatrickMurphy / About.md
Last active April 13, 2017 22:51
Smoke Processing Weekly Challenge 57
@PatrickMurphy
PatrickMurphy / Disc.js
Created February 28, 2017 01:02
P5linko
function Disc(parent, position, rad) {
this.parent = parent; // a PlinkoBoard object
this.position = position;
this.r = rad;
this.velocity = createVector(0, 0);
this.mass = 1;
this.acceleration = createVector(0, 0);
this.update = function () {
//this.applyForce(GRAVITY);
@PatrickMurphy
PatrickMurphy / Generate.js
Last active February 22, 2017 22:54
Markov's Cookbook
var data = require('./recipe-dataset.json');
var markov = require('./markov.js');
var name_generator = new markov.Generator(4, 32);
var ingred_generator = new markov.Generator(4, 750);
var desc_generator = new markov.Generator(7,500);
for (var i = 0; i < data.length; i++) {
name_generator.feed(data[i].name);
@PatrickMurphy
PatrickMurphy / BrownianPartical.pde
Last active February 14, 2017 19:35
Brownian Fractal Tree in Processing (Java)
class BrownianPartical {
PVector position;
float radius;
color fill;
BrownianPartical(PVector pos){
this(pos, color(255));
}
BrownianPartical(PVector pos, color c){
position = pos;
fill = c;