Skip to content

Instantly share code, notes, and snippets.

View stimms's full-sized avatar
💭
Talking at #MSIgniteToronto

Simon Timms stimms

💭
Talking at #MSIgniteToronto
View GitHub Profile
//enform specific code
require_once("../../lib/EnformSOAPClient.php");
$enf = new EnformSOAP();
$modulesComplete = array();
//just for PST and CSTS - because CSTS isn't a 'real' course we actually send completion for PST, odd I know
if($course->id == 104 || $course->id== 87)
{
$ers = $db->Execute("SELECT gi.itemname FROM mdl_grade_grades g, mdl_grade_items gi WHERE g.itemid = gi.id and g.userid={$USER->id} AND g.itemid IN (157,159,160,161)");
Features:
Features test\MavenThought.MediaLibrary.Acceptance.Tests\bin\Debug\MavenThoug
ht.MediaLibrary.Acceptance.Tests.dll
tools\nunit\nunit-console.exe /nologo test\MavenThought.MediaLibrary.Acceptan
ce.Tests\bin\Debug\MavenThought.MediaLibrary.Acceptance.Tests.dll
ProcessModel: Default DomainUsage: Single
Execution Runtime: net-2.0.50727.4952
drop table if exists "Movie"
@stimms
stimms / EnformSOAPClient.php
Created December 2, 2010 05:08
Soap definition for methods which call into Enform's services
<?php
/*
SOAP client to EnForm
This uses PHP5 built-in SoapClient
*/
if(!defined("HSE_PATH")) define("HSE_PATH", str_replace("/utils/cw_soap","",dirname(__FILE__)));
class EnformSOAP {
require 'soap/wsdlDriver'
require 'rubygems'
require 'mysql'
con = Mysql::connect("HOST", "USER", "PASSWORD", "DATABASE")
wsdl = 'http://enform.ca/externalCompletion/Service.svc?wsdl'
driver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
key = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
sql = "select firstname,
lastname,
@stimms
stimms / gist:813482
Created February 6, 2011 16:27
Economist translator
{
"translatorID":"6ec8008d-b206-4a4c-8d0a-8ef33807703b",
"label":"The Economist",
"creator":"Michael Berkowitz",
"target":"^http://(www\\.)?economist\\.com/",
"minVersion":"1.0.0b4.r5",
"maxVersion":"",
"priority":100,
"inRepository":"1",
"translatorType":4,
@stimms
stimms / LinqFizzBizz.cs
Created June 15, 2011 16:26
Linq fizzbizz
//silly
string result = Enumerable.Range(0, 100).Aggregate("", (current, nextValue) =>
{
if (nextValue % 3 != 0 && nextValue % 5 != 0)
{
current += nextValue;
}
if (nextValue % 3 == 0)
{
current += "Fizz";
@stimms
stimms / query.js
Created June 28, 2011 18:14
jQuery for querying latitude and longitude from a site
//create the results table
$(".bottomframe").append("<table id='results'><tr><th>Latitude</th><th>Logitude</th></tr></table>");
//only do one request at a time
$.ajaxSetup({async:false});
//perform the lookup
$.post("http://www.ags.gov.ab.ca/gis/map_converters/Convert_ATS_CGI.exe", {FTN:0, FTW:0, ILN: 5, IMN:4,IRN:3,ISN:1, ITN: 2, SPS: 'C'},
function(data){
var latitude = $($(data).find("td[colspan=3]")[0]).text();
@stimms
stimms / gist:1169508
Created August 24, 2011 22:52
Test using a container to get the late binding of IResolvers
[Test]
public void The_database_should_be_called()
{
ContainerBuilder builder = new ContainerBuilder();
var mockDrivingAlertRepository = new Mock<IDrivingAlertRepository>();
mockDrivingAlertRepository.Setup(x => x.GetDrivingTimeAlertByAlertID(It.IsAny<int>())).Returns(new CustomerEntities.DrivingTimeAlert());
builder.RegisterInstance<IDrivingAlertRepository>(mockDrivingAlertRepository.Object);
var handler = new Alerting.Handlers.DrivingTimeHandler(null, null, null, null, builder.Build());
@stimms
stimms / build.proj
Created November 18, 2011 14:14
MSBuild file which redefines a property
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Build">
<CreateProperty Value="firstValue">
<Output
TaskParameter="Value" PropertyName="LocalProp" />
</CreateProperty>
<Message Text="New value: $(LocalProp)" />
@stimms
stimms / tropo1
Created November 20, 2011 04:44
Replies via text
var text = currentCall.initialText;
call(currentCall.callerID,
{
network:"PSTN",
onAnswer: function()
{
say(text);
}
});