Skip to content

Instantly share code, notes, and snippets.

View jrusbatch's full-sized avatar

Justin Rusbatch jrusbatch

View GitHub Profile
<UsingTask TaskName="CombinePackageConfigs" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<PackageConfigFiles ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
<OutputPath ParameterType="System.String" Required="true" />
<CreatedFile ParameterType="Microsoft.Build.Framework.ITaskItem" Output="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Using Namespace="System.IO" />

scriptcs

What is it?

scriptcs makes it easy to write and execute C# with a simple text editor.

While Visual Studio, and other IDEs, are powerful tools, they can sometimes hinder productivity more than they promote it. You don’t always need, or want, the overhead of a creating a new solution or project. Sometimes you want to just type away in your favorite text editor.

scriptcs frees you from Visual Studio, without sacrificing the advantages of a strongly-typed language.

// Knockout JavaScript library v3.0.0beta
// (c) Steven Sanderson - http://knockoutjs.com/
// License: MIT (http://www.opensource.org/licenses/mit-license.php)
(function () {
var DEBUG = true;
(function (undefined) {
// (0, eval)('this') is a robust way of getting a reference to the global object
// For details, see http://stackoverflow.com/questions/14119988/return-this-0-evalthis/14120023#14120023
var window = this || (0, eval)('this'),
(function (global, undefined) {
'use strict';
var $ = global.jQuery;
/* Do stuff */
}(this));
public static class DbAsyncEnumerableExtensions
{
public static IAsyncEnumerable<T> AsAsyncEnumerable<T>(this IDbAsyncEnumerable<T> source)
{
Check.NotNull(source, "source");
return new DbAsyncEnumerableAdapter<T>(source);
}
private struct DbAsyncEnumerableAdapter<T> : IAsyncEnumerable<T>
{
(function(global) {
'use strict';
var BaseUri = 'http://query.yahooapis.com/v1/public/yql';
var DefaultParameters = {
diagnostics: true,
env: 'http://datatables.org/alltables.env'
};
### Keybase proof
I hereby claim:
* I am jrusbatch on github.
* I am jrusbatch (https://keybase.io/jrusbatch) on keybase.
* I have a public key whose fingerprint is 5761 701E 5034 D7F1 3808 CA1D C759 FEAD ED2E 3488
To claim this, I am signing this object:
public static Task<BrokeredMessage> OnMessageAsyncWrapper(CancellationToken cancellationToken = default(CancellationToken))
{
var tcs = new TaskCompletionSource<BrokeredMessage>();
try
{
if (cancellationToken.IsCancellationRequested)
{
tcs.SetCanceled();
return tcs.Task;
}

EventListener Polyfill

Is IE8 your new IE6? Level the playing field with polyfills.

This script polyfills addEventListener, removeEventListener, and dispatchEvent. It is less than half a kilobyte minified and gzipped.

addEventListener

addEventListener registers a single event listener on a single target.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
public static void Win()
{
Console.Beep(659, 125);
Console.Beep(659, 125);