Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Text;
namespace Example
{
public static class StringBuilderExtensions
{
/// <summary>
/// Removes all trailing occurrences of a set of characters specified in an array from the current <see cref="StringBuilder"/> object.
/// If no characters are specified, removes trailing whitespace.
@jtmueller
jtmueller / boxstarter.ps1
Last active October 12, 2017 06:07 — forked from jessfraz/boxstarter.ps1
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Orignal Author: Jess Frazelle <jess@linux.com>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:

Keybase proof

I hereby claim:

  • I am jtmueller on github.
  • I am xiggurat (https://keybase.io/xiggurat) on keybase.
  • I have a public key ASDWAv_x3nTnsGhK6rde3CMdwe_pOmeoZGVp0pjvwefb2Ao

To claim this, I am signing this object:

// Allows for strongly-typed access to underlying DOM elements when working with jQuery objects containing only a single element type.
interface JQueryOf<T extends HTMLElement> extends JQuery {
get(index: number): T;
get(): T[];
[index: number]: T;
eq(index: number): JQueryOf<T>;
first(): JQueryOf<T>;
last(): JQueryOf<T>;
slice(start: number, end?: number): JQueryOf<T>;
namespace Akka.FSharp
open System
/// The result of an Akka Ask operation, either a value or an exception.
type AskResult<'TResult> =
| Ok of result: 'TResult
| Err of exn
with
/// Retrieves the value on success, throws an exception if there was an error.
// Akka F# API
type ICanTell with
member this.Ask(msg: obj, timeout: TimeSpan): Async<'Response> =
this.Ask<'Response>(msg, Nullable(timeout)) |> Async.AwaitTask
// If we do this.Ask().ContinueWith(..) after shutting down the host for a remote actor,
// the task passed into ContinueWith has IsFaulted = false and Exception = null, but throws
// an AggregateException when the Result property is accessed.
// Knowing this, I wrote the following replacement to the Akka F# API extension method above.
function foo()
{
return
{
a: 1,
b: 3,
c: 7
};
}
test 7 "=3 + 4"
test -1.5 "=-C3"
test -8 "=-2 ^ 3"
test true "=AND(2+2=4, 2+3=5)"
test "Not OK" "=IF(C3 <= C4, \"OK\", \"Not OK\")"
test -4257.44 "=(C1 + C3 - 1) * -C5"
test -4 "=(3 - (4 + 5)) + 2"
test "Not quite." "=IF(AND(2+2=4, 3+4>6, 5*9<10), \"All true!\", \"Not quite.\")"
test "Some true" "=IF(OR(2+2=4, 3+4>6, 5*9<10), \"Some true\", \"Not quite.\")"
test 24.0 "=C3 * 4 ^ 2"
let forMember (destMember: Expr<'dest -> 'mbr>) (memberOpts: IMemberConfigurationExpression<'source> -> unit) (map: IMappingExpression<'source, 'dest>) =
map.ForMember(Expr.ToFuncExpression <@ %destMember >> box @>, memberOpts)
@jtmueller
jtmueller / gist:2416115
Created April 18, 2012 19:56
Chrome Frame Prompt
<!--[if lte IE 8]>
<script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
<script>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'});});</script>
<![endif]-->