Skip to content

Instantly share code, notes, and snippets.

@Jeff-Walker
Jeff-Walker / SimpleGridLayout.cs
Created April 13, 2012 16:14
Enhanced SimpleGridLayout
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
namespace Wpf {
/*
* This code is made available with no warranty. It comes as-is, but discuss changes if you like.
* I consider this in the public domain.
@Jeff-Walker
Jeff-Walker / dev_setup.ps1
Last active April 14, 2016 22:01 — forked from thitemple/dev_setup.ps1
A PowerShell script for installing a dev machine using Chocolatey.
function Add-Path() {
[Cmdletbinding()]
param([parameter(Mandatory=$True,ValueFromPipeline=$True,Position=0)][String[]]$AddedFolder)
# Get the current search path from the environment keys in the registry.
$OldPath=(Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).Path
# See if a new folder has been supplied.
if (!$AddedFolder) {
Return 'No Folder Supplied. $ENV:PATH Unchanged'
}
# See if the new folder exists on the file system.
@Jeff-Walker
Jeff-Walker / protips.js
Created March 13, 2017 05:27 — forked from nolanlawson/protips.js
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");