Skip to content

Instantly share code, notes, and snippets.

@Jeff-Walker
Jeff-Walker / protips.js
Created Mar 13, 2017 — forked from nolanlawson/protips.js
Promise protips - stuff I wish I had known when I started with Promises
View protips.js
// 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!");
@Jeff-Walker
Jeff-Walker / dev_setup.ps1
Last active Apr 14, 2016 — forked from thitemple/dev_setup.ps1
A PowerShell script for installing a dev machine using Chocolatey.
View dev_setup.ps1
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 / SimpleGridLayout.cs
Created Apr 13, 2012
Enhanced SimpleGridLayout
View SimpleGridLayout.cs
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.