Skip to content

Instantly share code, notes, and snippets.

View programatt's full-sized avatar
😃
Code is neat.

Matt Phillips programatt

😃
Code is neat.
View GitHub Profile
@programatt
programatt / euroVersusSandPindicator
Created October 14, 2011 06:11
thinkScript $ES_F vs $6E_F indicator
#This script will plot the change in Euro FX Futures versus the change in emini S&P futures
declare lower;
input eu = "/6E";
input sp = "/ES";
plot data =(close(eu)-close(eu)[1])*1000;
plot Data2 = (close(sp)-close(sp)[1]);
@programatt
programatt / gist:1297428
Created October 19, 2011 03:41
What if science was capitalist?
It's true. Remember that the so called "speed of light" was imposed by an atheist jew intellectual, and has since been propped up by an academic elitist cabal supported by big government's tax-and-spend agenda. In fact, the entire enterprise of physics is inherently statist. It spends essentially all its time and resources imposing as many universal laws as possible. If only physics were deregulated, and the behavior of matter and energy left to the free market, those particles whose behavior is best adapted to the demands of the marketplace would outcompete less efficient matter and create a utopia.
@programatt
programatt / gist:1566149
Created January 5, 2012 17:05
Why does resharper think this is wrong?
catch (WebException e)
{
if(e.Response != null)
{
//resharper claims next line "Possible null assignment to entity
//marked with NotNull attribute.
//makes no sense to me because i'm checking null first
var r = new StreamReader(e.Response.GetResponseStream());
var data = r.ReadToEnd();
@programatt
programatt / messedup.cs
Created February 8, 2012 05:37
Data Model problems
using System;
using System.ComponentModel;
namespace ProblemChild.Models
{
public class FinancialProductBase
{
public int Id { get; set; }
public DateTime Timestamp { get; set; }
public string TraderName { get; set; }
@programatt
programatt / winning.cs
Created February 17, 2012 04:26
Instrument with property access
public class Instrument : DynamicObject
{
public int FinancialInstrumentId { get; private set; }
public string SpecialType { get; private set; }
public Instrument(int finId,string specialType)
{
FinancialInstrumentId = finId;
SpecialType = specialType;
@programatt
programatt / gist:3129683
Created July 17, 2012 14:22
Jabbr user count every 10 seconds
setInterval(function(){
var totalPop = 0
, roomPops = $('#userlist-lobby .room .count').text().match(/\d+/g);
for (var i = 0, l = roomPops.length; i < l; i++) {
totalPop += parseInt(roomPops[i]);
}
console.log(totalPop);
},10000);
@programatt
programatt / gist:3130222
Created July 17, 2012 15:49
Jabbr Users 10 Seconds
setInterval(function(){
var totalPop = 0
, roomPops = $('#userlist-lobby .room .count').text().match(/\d+/g);
for (var i = 0, l = roomPops.length; i < l; i++) {
totalPop += parseInt(roomPops[i]);
}
console.log(totalPop);
},10000);
@programatt
programatt / TestableTypeFactory.cs
Created August 23, 2012 01:29
Any order mocked construction parameters
using System;
using System.Linq;
using Moq;
using Xunit;
namespace Tests.UnitTests.Services
{
public class TestableTypeFactory
{
public static T GetType<T>(params object[] constructorParameters)
;
; boot.s -- Kernel start location. Also defines multiboot header.
; Based on Bran's kernel development tutorial file start.asm
;
MBOOT_PAGE_ALIGN equ 1<<0 ; Load kernel and modules on a page boundary
MBOOT_MEM_INFO equ 1<<1 ; Provide your kernel with memory info
MBOOT_HEADER_MAGIC equ 0x1BADB002 ; Multiboot Magic value
; NOTE: We do not use MBOOT_AOUT_KLUDGE. It means that GRUB does not
; pass us a symbol table.
@programatt
programatt / rps.hs
Created January 8, 2014 05:10
rock paper scissors in haskell using StateT
import System.Random
import Control.Monad.State
data Hand = Rock | Scissors | Paper deriving(Show,Eq)
data Result = Win | Lose | Tie deriving(Show)
type Score = (Int,Int)
fight :: Hand -> Hand -> Result
fight h1 h2 | h1 == h2 = Tie
| h1 == Rock && h2 == Scissors = Win