Skip to content

Instantly share code, notes, and snippets.

View willryan's full-sized avatar
😕
Why does GitHub need a status?

William Pleasant-Ryan willryan

😕
Why does GitHub need a status?
View GitHub Profile
import Ember from 'ember';
import hbs from 'htmlbars-inline-precompile';
import connect from 'ember-redux/components/connect';
var stateToComputed = (state) => {
return {
number: state.number
};
};
@willryan
willryan / BindPropertyToObservable.cs
Created June 14, 2016 21:24
how to bind a Property on an MVVM Light ViewModelBase to an IObservable<>
namespace App
{
class AppPropertyInfo
{
public IDisposable Subscription;
public string Name;
public Func<IDisposable> Subscribe;
}
class AppCommandInfo
@willryan
willryan / stop_iis_express.ps1
Last active August 29, 2015 14:13
Stopping IIS Express for a project
foreach($proc in (ps | Where { $_.name -like "iisexpress"} )) {
$iisid = $proc.Id
$iis = Get-WmiObject Win32_Process -filter "ProcessId=$iisid" | Where-Object { $_.CommandLine -like "*MyProjectName*" } | Select-Object -first 1
if($iis) {
stop-process -force $iis.ProcessId
}
}
@willryan
willryan / port_open.rb
Created January 13, 2015 18:27
Checking if a TCP port is in use
def is_port_open?(ip, port)
begin
Timeout::timeout(20) do
begin
s = TCPSocket.new(ip, port)
s.close
return true
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
return false
end
@willryan
willryan / NUnitTemplate
Created September 18, 2013 00:24
NUnit Template
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
namespace $rootnamespace$
{
[TestFixture]
public class $safeitemname$
@willryan
willryan / MyBaseGebTest.groovy
Created October 11, 2012 16:40
Geb DB test helpers
abstract class MyBaseGebTest extends GebReportingTest {
SessionFactory sessionFactory = ApplicationHolder.application.mainContext.sessionFactory
def inTransaction(closure) {
inNewSession {
TransactionRunner.getInstance().runInNewTransaction(closure)
}
}
def inNewSession(closure) {
@willryan
willryan / BasePage.groovy
Created October 11, 2012 16:38
displayed helper for Geb tests
class BasePage extends Page {
// use inside content definitions to prevent wait success until the element is displayed
static displayed(elem) {
(elem?.displayed) ? elem : null
}
}