This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<!--[if lt 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]--> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cnStr = ConfigurationManager.ConnectionStrings["foo"].ConnectionString; | |
using (var conn = new SqlConnection(cnStr)) | |
using (var cmd = conn.CreateCommand()) | |
{ | |
// if you use a stord proc, change the type, and put the proc name in CommandText | |
cmd.CommandType = CommandType.Text; | |
cmd.CommandText = "IF NOT EXISTS (SELECT fooID FROM table WHERE fooID = @fooID) BEGIN " + | |
"INSERT INTO table (fooID, a, b, c, d) " + | |
"VALUES (@fooID, @a, @b, @c, @d) END"; | |
var id = cmd.Parameters.Add("@fooID", SqlDbType.Int); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Collections.Generic; | |
using System.Linq; | |
public static class Decoder | |
{ | |
private const string inputFile = "A-small-practice.in.txt"; | |
private static readonly string[] crypt = new[] { "ejp mysljylc kd kxveddknmc re jsicpdrysi", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--[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]--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let forMember (destMember: Expr<'dest -> 'mbr>) (memberOpts: IMemberConfigurationExpression<'source> -> unit) (map: IMappingExpression<'source, 'dest>) = | |
map.ForMember(Expr.ToFuncExpression <@ %destMember >> box @>, memberOpts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function foo() | |
{ | |
return | |
{ | |
a: 1, | |
b: 3, | |
c: 7 | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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>; |
OlderNewer