Skip to content

Instantly share code, notes, and snippets.

@neilcampbell
neilcampbell / __main__.py
Created February 14, 2024 16:33
Pyinstaller windows symlink issue in onedir mode
print("Hello world!")
@neilcampbell
neilcampbell / sample.cs
Last active August 6, 2019 02:53
build pact uri from environment tags
using System;
using System.Linq;
public class Program
{
public static void Main()
{
var env = "prod master"; // Environment.GetEnvironmentVariable("PACT_TAGS");
var tags = env.Split(' ');
var uris = tags.Select(t => $"http://broker-host/pacts/provider/MyProvider/consumer/MyConsumer/{t}");
@neilcampbell
neilcampbell / pact-publish.ps1
Last active August 12, 2021 08:19
Pact Broker Publish Script
param(
$buildMetadataFile = "package.json",
$workingDir = (Get-Location),
$pactsDir = (Join-Path $workingDir "pacts"),
$pactBroker = "http://my-pact-broker",
$templateUrl = "$pactBroker/pacts/provider/:provider/consumer/:consumer/version/:version",
@neilcampbell
neilcampbell / MySmartComponent.js
Last active October 10, 2015 06:13
React/Redux/ES6
import React from 'react/addons';
import { connect } from 'react-redux';
import { subscribeToSomethings } from '../actions/somethingsActions';
export default class MySmartComponent extends React.Component {
constructor(props, context) {
super(props, context);
this.state = {
somethingsSubscription: null
};
@neilcampbell
neilcampbell / trading.js
Last active August 29, 2015 14:25
ES6 Generators with Promises
(function(target) {
let run = generator => {
let sequence;
let process = result => {
if(result.done) { return; }
result.value
.then(value => {
process(sequence.next(value));
})
@neilcampbell
neilcampbell / monster.js
Last active August 29, 2015 14:24
ES6 Monster
(function(target) {
let _health = Symbol();
let _speed = Symbol();
class Monster {
constructor(name, health, speed) {
this.name = name;
this[_health] = health;
this[_speed] = speed;
}
public class DropOutStack<T> : LinkedList<T>
{
private readonly int _capacity;
public DropOutStack(int capacity)
{
_capacity = capacity;
}
public void Push(T item)