Skip to content

Instantly share code, notes, and snippets.

View DominicFinn's full-sized avatar
💭
Whirring away

Dominic Finn DominicFinn

💭
Whirring away
View GitHub Profile
bookings.bookingPresenter = function($div, eventsBus) {
// Handle page events and user interaction here. Delegate the functionality on the bus.
// query the Dom on the smallest element you can, i.e. never do $('').find for everything
var $form = $div.find('#orderForm');
$div.find('.orderButton').click(function(e) {
e.preventDefault()
@DominicFinn
DominicFinn / JPanelEvents.java
Created November 1, 2013 14:26
An Example of hooking up events for a JPanel
package examples;
import javax.swing.JPanel;
public class MyWindow extends javax.swing.JFrame {
//The static main is the entrance to the program
public static void main(String args[]) {
System.out.println("loading");
@DominicFinn
DominicFinn / XOR-Demo.cs
Created December 20, 2013 23:53
A little XOR calculation demo created as I am working through the Pluralsight course http://pluralsight.com/training/Courses/Description/introduction-to-machine-learning-encog This example relies on the Encog libs which are available on Nuget.
using Encog.Engine.Network.Activation;
using Encog.ML.Data.Basic;
using Encog.Neural.Networks;
using Encog.Neural.Networks.Layers;
using Encog.Neural.Networks.Training.Propagation.Resilient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@DominicFinn
DominicFinn / HappyController.cs
Created January 20, 2014 17:03
The sad controller is tightly coupled to a specific implementation of the management class. We need to be coding against interfaces. This grants us at least two major wins: 1. We can refactor / improve the management class without worrying about the controller, we just need to ensure the interface is still satisfied. 2. We can test different par…
public sealed class HappyController : Controller {
private IManagement management;
public HappyController(IManagement management) {
this.management = management
}
[HttpGet]
public ViewResult LooselyCoupleThings() {
@DominicFinn
DominicFinn / thisworkbook.vb
Last active January 4, 2016 00:39
Bit of code to stop a worksheet from saving until the cells provided have something in them. // code is VBA :-/
Dim msg As String
Dim cancel As Boolean
Private Sub Workbook_BeforeSave(ByVal SaveAsUi As Boolean, cancel As Boolean)
CheckAndMark "B42", "Cell B42 must be filled in with a NAME before saving."
CheckAndMark "b51", "Cell B51 needs a random number"
If cancel Then
MsgBox msg
using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
@DominicFinn
DominicFinn / case.sql
Created March 7, 2014 16:13
Case statement for Wilf
declare @number int
set @number = 1
select case @number when 1
then 'yes'
else 'no'
end as NumberOrYes
@DominicFinn
DominicFinn / owin.cs
Created May 30, 2014 15:05 — forked from serialseb/owinfx
dsfg
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Nancy;
using Nancy.Owin;
using Nowin;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Nancy;
using Nancy.Owin;
using Nowin;
public class Appointment : IAggregateRoot
{
public Appointment(Guid id, AppointmentType type, .....)
{
switch type
{
case: AppointmentType.TypeOne
Apply(new TypeOneAppointmentCreated());
case: AppointmentType.TypeTwo
Apply(new TypeTwoAppointmentCreated());