Skip to content

Instantly share code, notes, and snippets.

View mattneary's full-sized avatar

Matt Neary mattneary

View GitHub Profile
public class ClsSurfacePlaneIntersector : ClsIntersector {
public int Precision = 100;
public Vector3 FindPointIntersection(Func<float, Vector3> surfaceSlice, float elevation, float min, float max) {
var mid = (max + min) / 2;
var minE = surfaceSlice(min).Z;
var midE = surfaceSlice(mid).Z;
var maxE = surfaceSlice(max).Z;
if (FuzzyEqual(elevation, midE) || FuzzyEqual(mid, max)) {
return surfaceSlice(mid);
}
@mattneary
mattneary / ClsSensorPlaneIntersector.cs
Last active August 29, 2015 14:03
Bezier surface intersection with a plane.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Kiss.Effigy.code {
public class ClsSensorPlaneIntersector {
public Vector Origin;
public Func<float, float, Vector> Parametric;
public float Plane;
@mattneary
mattneary / add.sh
Last active August 29, 2015 13:56
Add SSH Key
#!/bin/bash
# Run locally
cat ~/.ssh/id_rsa.pub | ssh [email protected] 'cat >> /etc/ssh/watterson/authorized_keys'
ssh [email protected] 'sudo service ssh restart'
@mattneary
mattneary / docs.md
Created December 4, 2013 17:22
API docs

Group (appname: auth)

  • /api/group/ - returns a list of first 20 groups
  • /api/group/?start=0 - returns a list of first 20 groups
  • /api/group/?start=10 - returns a list of 20 groups starting from 10th group
  • /api/group/?start=10&count=30 - returns a list of 30 groups starting from 10th group
    • "count" is the number of items to be returned, from the position equal to "start" value.
@mattneary
mattneary / unorder_search.sql
Last active December 29, 2015 08:09
UPDATE queries
'x LIKE "%'+'a b c'.gsub(/\s/, '%" AND x LIKE "%')+'%"'
@mattneary
mattneary / examples.php
Last active December 28, 2015 10:29
Shitty PHP
<?
/*
PHP takes the design of Perl (ugly), the interfaces
of C (low-level and clunky), and the OO of C++
(an impure mess). Some things are completely broken,
and every API is either inconsistent or just
inconvenient.
Its only utility is its output of inline text, which
@mattneary
mattneary / index.js
Created September 23, 2013 19:50
Fix fix
// lemonad source...
L.fix1 = L.curry(L.curry)(1);
L.fix2 = L.curry(L.curry)(2);
L.fix3 = L.curry(L.curry)(3);
L.fix4 = L.curry(L.curry)(4);
// function we could provide:
L.fix = L.curry(L.curry);
@mattneary
mattneary / adder.html
Created July 20, 2013 18:51
SO Adder
<script>
var inputs = {};
function save(value, name) {
inputs[name] = parseInt(value);
}
function checker(criterion, action) {
return function(value, name) {
if( !criterion(value) ) {
alert("Not Numeric");
} else {
@mattneary
mattneary / resume.md
Last active December 19, 2015 15:59
My Résumé
@mattneary
mattneary / eagle-control.c
Last active December 18, 2015 10:09
Robotics Institute Team Code
#pragma config(Motor, motorA, leftMotor, tmotorNXT, PIDControl, encoder) //
#pragma config(Motor, motorB, rightMotor, tmotorNXT, PIDControl, encoder) //
#pragma config(Sensor, S1, touchSensor, sensorTouch) //
//
#include "./Headers/JoystickDriver.c" //
// Do Not Add Or
float speed = 1.0; // Modify Code Above
#include "./Headers/Control Header.c" //
//
#define THRESHOLD 0 //