Skip to content

Instantly share code, notes, and snippets.

View jasonm23's full-sized avatar

Jason Milkins jasonm23

View GitHub Profile
@jasonm23
jasonm23 / test.sh
Created October 13, 2010 04:59
while read example for PB
#!/bin/bash
cat test.csv | while IFS=, read IndexNum Num Name Country Age_Sex Sire DAM Weight Jockey Trainer Career Last_6 Prize imageurl;
do
echo "record[$IndexNum] = {
num=\"$Num\",
name=\"$Name\",
country=\"$Country\",
age_sex=\"$Age_Sex\",
@jasonm23
jasonm23 / google-region.el
Created October 21, 2010 01:21
google search defun for emacs
(defun google ()
"Googles a query or region if any."
(interactive)
(browse-url
(concat
"http://www.google.com/search?ie=utf-8&oe=utf-8&q="
(if mark-active
(buffer-substring (region-beginning) (region-end))
(read-string "Query: ")))))
@jasonm23
jasonm23 / gist:803692
Created January 31, 2011 05:56
Use cupsfilter and RDiscount to convert Markdown text to PDF (via HTML)
t=$(mktemp -t preview); cat README.md | rdiscount > $t.html; cupsfilter $t.html > $t.pdf; open $t.pdf
@jasonm23
jasonm23 / opengl_rotation_demo.cpp
Created January 31, 2011 23:15
Forked from NeHe's rotation tutorial. Adds cursor up/down to interact with rotation value. (also num pad modifies rotation axis, x,y,z, off/on)
/*
* This Code Was Created By Jeff Molofee 2000
* A HUGE Thanks To Fredric Echols For Cleaning Up
* And Optimizing The Base Code, Making It More Flexible!
* If You've Found This Code Useful, Please Let Me Know.
* Visit My Site At nehe.gamedev.net
* Conversion to Visual Studio.NET done by Grant James(ZEUS)
*/
#include <windows.h> // Header File For Windows
/*
* This Code Was Created By Jeff Molofee 2000
* A HUGE Thanks To Fredric Echols For Cleaning Up
* And Optimizing The Base Code, Making It More Flexible!
* If You've Found This Code Useful, Please Let Me Know.
* Visit My Site At nehe.gamedev.net
*/
#include <windows.h> // Header File For Windows
@jasonm23
jasonm23 / SocketServer.cs
Created February 1, 2011 02:57
very very basic socket chat server with a few features.
using System;
using System.Collections;
using System.Net;
using System.Net.Sockets;
using System.IO;
using System.Text;
using System.Timers;
using System.Web;
using System.Xml;
using System.Diagnostics;
@jasonm23
jasonm23 / gist:810412
Created February 3, 2011 23:02 — forked from rdp/gist:810398
// enum.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <cstdio>
#include <cstring>
#include <windows.h>
#include <comcat.h>
int _tmain(int argc, _TCHAR* argv[])
@jasonm23
jasonm23 / Grid Construction
Created May 17, 2011 04:09
Paste into the sketch.processing.org page, and click the Run Button.
public class Point {
public int x;
public int y;
Point rel(float angle, float length){
Point a = new Point();
a.x = int(x+cos(radians(angle))*length);
a.y = int(y-sin(radians(angle))*length);
return a;
}
@jasonm23
jasonm23 / HexLatticeType5.pde
Created May 18, 2011 05:34
Hex lattice type 5 - processing (v.0.1)
int radius = 140;
int unit = radius / 8;
// unused at the moment.
PVector[] figurePoints;
int stageSize = 640;
@jasonm23
jasonm23 / gist:1108527
Created July 27, 2011 02:11
Use reflection to call a method on all subtypes of MyBasetype
Assembly
.GetExecutingAssembly()
.GetTypes()
.Where(t => t.IsClass && t.BaseType.Name == "MyBasetype")
.ToList()
.ForEach(c =>
{
MethodInfo m = c.GetMethod("MyMethod");
if(m == null) return;
m.Invoke(null, null);