Skip to content

Instantly share code, notes, and snippets.

View m2web's full-sized avatar

Mark McFadden m2web

View GitHub Profile
@m2web
m2web / gist:057d156dfd31ad3e4af1
Last active August 29, 2015 18:41
C# NUnit Test Except And Intersect
[Test]
public void TestExceptAndIntersect()
{
//check if equal with differing sequence
var list1 = new List<int>(new int[] { 1, 2, 3, 4, 5, 6 });
var list2 = new List<int>(new int[] { 6, 5, 4, 3, 2, 1 });
var result = list1.Except(list2).ToList();
Assert.AreEqual(new int[] { }, result);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Test Canvas</title>
<!-- get excanvas.js from http://code.google.com/p/explorercanvas/
Note the test cases and examples. Very cool! -->
<!--[if IE]>
<script src="excanvas.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Test Canvas II</title>
<!-- get excanvas.js from http://code.google.com/p/explorercanvas/
Note the test cases and examples. Very cool! -->
<!--[if IE]>
<script src="excanvas.js"></script>
@m2web
m2web / MultiplyNegativeNumbersProof.rb
Created January 20, 2012 15:56
-2*-2 = 2*2. In other words, when you multiply 2 negative integers it is the same as multiplying the same two positive integers. -x*-y = x*y.
#-2*-2 = 2*2. In other words, when you
#multiply 2 negative integers it is the
#same as multiplying the same two positive
#integers. -x*-y = x*y
x = 2
y = 3
puts ((x*y + x*-y) + -x*-y == x*y) ==
((x*y + x*-y) + -x*-y == -x*-y)
@m2web
m2web / .autotest
Created March 1, 2012 11:52
My .autotest file
# ~.autotest
require 'rubygems'
require 'autotest_notification'
SPEAKING = false
DOOM_EDITION = false
BUUF = false
PENDING = false
STICKY = false
SUCCESS_SOUND = ''
FAILURE_SOUND = ''
#!!/usr/bin/env python
import RPi.GPIO as GPIO, time
GPIO.setmode(GPIO.BCM)
GREEN_LDE = 18
RED_LED = 23
GPIO.setup(GREEN_LED, GPIO.OUT)
GPIO.setup(RED_LED, GPIO.OUT)
count = 0
@m2web
m2web / raspi-blink.py
Created September 14, 2012 19:11
Raspberry Pi script to blink LEDs
class CreateTableNameSequence < ActiveRecord::Migration
def up
#create sequence for categories table
execute <<-SQL
CREATE SEQUENCE table_name_id_seq
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 25
CACHE 1;
class AddSequenceToTableName < ActiveRecord::Migration
def up
#add sequence to
execute <<-SQL
ALTER TABLE table_name ALTER COLUMN id SET DEFAULT nextval('table_name_id_seq'::regclass);
SQL
end
def down
execute <<-SQL
@m2web
m2web / webSiteScrapeAndFileCreation.py
Last active December 16, 2015 14:49
Here is code that I used to scrape a site of poem content.
import urllib
import re
def find_between( s, first, last ):
try:
start = s.index( first ) + len( first )
end = s.index( last, start )
return s[start:end]
except ValueError:
return ""