Skip to content

Instantly share code, notes, and snippets.

View darrencauthon's full-sized avatar

Darren Cauthon darrencauthon

View GitHub Profile
@darrencauthon
darrencauthon / test.js
Created February 4, 2018 20:21
Demoable agent that uses DataSet
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.vis=e():t.vis=e()}(this,function(){return function(t){function e(o){if(i[o])return i[o].exports;var n=i[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,e),n.l=!0,n.exports}var i={};return e.m=t,e.c=i,e.d=function(t,i,o){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=123)}([function(t,e,i){e.__esModule=!0,e.default=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e,i){e.__esModule=!0;var o=i(169),n=function(t){return t&&t.__esModule?t:{default:t}}(o);e.default=function(){function t(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.c
@darrencauthon
darrencauthon / example.cs
Created August 3, 2016 11:14
Testing each usage of ?.
void Main()
{
It_should_return_the_name_from_the_person_on_the_invoice_on_the_order();
It_should_return_nothing_if_the_person_is_not_set();
It_should_return_nothing_if_the_invoice_is_not_set();
It_should_return_nothing_if_given_nothing();
}
public static string GetNameFrom(Order order)
{
##########################################
# To run:
# curl -sSL https://gist.githubusercontent.com/sirkkalap/e87cd580a47b180a7d32/raw/d9c9ebae4f5cf64eed4676e8aedac265b5a51bfa/Install-Docker-on-Linux-Mint.sh | bash -x
##########################################
# Check that HTTPS transport is available to APT
if [ ! -e /usr/lib/apt/methods/https ]; then
sudo apt-get update
sudo apt-get install -y apt-transport-https
fi
@darrencauthon
darrencauthon / AModel.cs
Last active June 3, 2016 04:56 — forked from srakowski/AModel.cs
Example of Dynamic Proxy ViewModel in C#?
using System;
namespace VMSandbox
{
class AModel
{
public DateTime Date { get; set; } = DateTime.UtcNow;
public int MyLifeForTheCodeDownloads { get; set; } = Int32.MaxValue;
}
@darrencauthon
darrencauthon / sample_code.txt
Created March 13, 2016 17:48
Loading a gem via IRB
# https://github.com/banzsolt/wargaming_api/
wargaming_api git:(master) bundle exec irb
2.0.0-p647 :001 > WargamingApi::Accounts
NameError: uninitialized constant WargamingApi::Accounts
from (irb):1
from /Users/darrencauthon/.rvm/rubies/ruby-2.0.0-p647/bin/irb:12:in `<main>'
2.0.0-p647 :002 > require_relative 'lib/wargaming_api'
accounts -> Players loaded.
@darrencauthon
darrencauthon / testing.cs
Last active February 11, 2016 19:12
Testing samples, strict or loose
using System;
using AutoMoq.Helpers;
using Moq;
using NUnit.Framework;
namespace JamesDemo
{
public class Presenter
{
private readonly IRepository repository;
@darrencauthon
darrencauthon / view_model.rb
Created February 4, 2016 20:07
Simple view model in Ruby
class ViewModel
def initialize subject
@subject = subject
end
def method_missing meth, _, _
@subject.send meth
end
end
@darrencauthon
darrencauthon / scroll.ps
Created December 10, 2015 19:40 — forked from alanstevens/scroll.ps
Mac scrolling on windows from powershell
Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 1 }
@darrencauthon
darrencauthon / comment.txt
Created September 11, 2015 14:17
Comment on "How I Came To Love TypeScript"
http://developer.telerik.com/featured/how-i-came-to-love-typescript
You wrote "My favorite thing about all of this is the fact that I know, without a
shadow of a doubt, that when I run this, it’s going to work."
Are you really that sure? I think you may be reading too deeply into the IDE's method checks.
Take your last three lines of code:
let mainPage = <page.Page>args.object;
class EventSubscriber
def self.inherited subscriber
@subscribers ||= []
@subscribers << subscriber
end
def self.all
@subscribers ||= []
end