Skip to content

Instantly share code, notes, and snippets.

View jcteague's full-sized avatar

John Teague jcteague

  • CapitalOne
  • Austin, TX
View GitHub Profile
@jcteague
jcteague / http-polling.cs
Created January 28, 2016 22:11
some rx examples
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
using tests;
@jcteague
jcteague / spec.js
Last active August 29, 2015 14:01
Creating Test Mongoose data with fixtures
var Factory = require('AutoFixture');
require('./fixtures')(Factory);
var TestHelper = require("./testHelper");
testHelper = new TestHelper();
describe("Tests",function(){
before(function(done){
//the models are saved in mongodb, then dynamically attached to testHelper
testHelper.create([
{name:'admin', model:'User', val:Factory.create 'User',{approved:true, email:'adminEmail', roles:['admin']}},
@jcteague
jcteague / anonymous_object_as_closure.java
Last active August 29, 2015 13:58
using anonymous object as a closure
public class UCDObjectToInformationRequirementConverter {
public MyObject ConvertFrom(KeyValueObject kvObject){
final MyObject result = new MyObject();
Set<KeyValueNode<?,?>> nodes = kvObject.getNodes();
for(UCDNode node : nodes){
getFieldValue(node,"_id", new FieldValueSetter() {@Override public void setField(String value) {result.setId(value);}});
}
return result;
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using PropertyRegistration.Common.Infrastructure.Extensions;
namespace PropertyRegistration.Common.Models.Enumerations
{
[Serializable]
public abstract class Enumeration : IEquatable<Enumeration>
using FluentMigrator;
using ViewSourceMigrations.CustomMigrations;
using ViewSourceMigrations.Extensions;
namespace ViewSourceMigrations.Migrations {
[ Migration( 20121206112020 ) ]
public class Migration20121206112020CreateVendorTable : HiLoMigration {
public override void Up( ) {
Create.Table(ProgramConstants.Tables.Vendor)
@jcteague
jcteague / CustomerPreferencesEnum.cs
Created February 25, 2013 19:14
polymorphic behavior part 2 examples
public enum CustomerMessagePreferences
{
SMS, Email
}
@jcteague
jcteague / Message.cs
Last active December 14, 2015 01:39
Polymorphic behavior, but breaking Liskoff
public class SMSMessenger : ISendMessages{
public string Carrier {get;set;}
void Send(Message msg){
//send the msg
}
}
@jcteague
jcteague / EmailMessenger.cs
Created February 20, 2013 19:13
Polymorphic Behavior Examples
public class EmailMessenger: ISendMessages{
void Send(Message msg){
//do all the work to send an email
}
}
@jcteague
jcteague / commands.coffee
Created December 14, 2012 20:54
combined requirejs module
define (require) ->
{
resize: require 'ResizeCommand'
rotate: require 'RotateCommand'
}