Skip to content

Instantly share code, notes, and snippets.

View daniel-chambers's full-sized avatar

Daniel Chambers daniel-chambers

View GitHub Profile
@daniel-chambers
daniel-chambers / monokai-theme.json
Last active June 1, 2020 04:31
Monokai Theme for Windows Terminal
{
"name": "Monokai",
"background": "#272822",
"black": "#272822",
"blue": "#01549E",
"brightBlack": "#7C7C7C",
"brightBlue": "#0383F5",
"brightCyan": "#58C2E5",
"brightGreen": "#8DD006",
"brightPurple": "#A87DB8",

Keybase proof

I hereby claim:

  • I am daniel-chambers on github.
  • I am danielchmbrs (https://keybase.io/danielchmbrs) on keybase.
  • I have a public key ASATFq9oxibAcdM_Ifl_6C1OA2QDvXBP0VQrVPrGuqbl6go

To claim this, I am signing this object:

@daniel-chambers
daniel-chambers / FizzBuzz.fs
Last active February 27, 2018 10:07
FizzBuzz in F#
let fizzDiv ys str x =
if ys |> List.forall (fun y -> x % y = 0)
then Some str
else None
let fizzBuzzChecks x =
(fizzDiv [3;5] "FizzBuzz" x)
|> Option.orElse (fizzDiv [5] "Buzz" x)
|> Option.orElse (fizzDiv [3] "Fizz" x)
|> Option.defaultValue (string x)
@daniel-chambers
daniel-chambers / FreeAp.hs
Last active August 30, 2016 01:45 — forked from adbrowne/FreeAp.hs
Free Applicative Example
module Main where
import Lib
import Data.Monoid
import Data.Map (Map)
import Data.Maybe
import qualified Data.Map as Map
import Control.Concurrent (threadDelay)
import Control.Concurrent.Async
import Control.Applicative.Free
@daniel-chambers
daniel-chambers / AadExtensions.cs
Last active May 29, 2018 04:10
Get All Users in AppRole in Azure Active Directory
public static class AadExtensions
{
public static async Task<IEnumerable<IUser>> GetAllUsersInAppRoleAsync(
this IActiveDirectoryClient client,
string servicePrincipalObjectId,
string appRoleId)
{
var guidAppRoleId = Guid.Parse(appRoleId);
var appRoleAssignmentsPaged = await client.ServicePrincipals
.GetByObjectId(servicePrincipalObjectId)
var system = require('system'),
env = system.env;
/**
* Wait until the test condition is true or a timeout occurs. Useful for waiting
* on a server response or for a ui change (fadeIn, etc.) to occur.
*
* @param testFx javascript condition that evaluates to a boolean,
* it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or
* as a callback function.
type Building = {
left : int
right : int
height : int
}
let buildings : Building[] = [| (* ... *) |]
let getHeight building = building.height
let getWidth building = building.right - building.left