Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View tejacques's full-sized avatar

Tom Jacques tejacques

  • Tinder
  • Los Angeles
View GitHub Profile
@tejacques
tejacques / keybase.md
Last active September 21, 2016 19:04

Keybase proof

I hereby claim:

  • I am tejacques on github.
  • I am tejacques (https://keybase.io/tejacques) on keybase.
  • I have a public key whose fingerprint is 8D52 2AF4 F797 A946 BD36 FA92 5498 9516 13E3 FAC8

To claim this, I am signing this object:

; (function (global, define) { define('module-name', function (require, exports, module) {
// CommonJS style code here
/*!
* UMD/AMD/Global context Module Loader wrapper
* based off https://gist.github.com/tejacques/202a8f2d198ddd54a409
*
* This wrapper will try to use a module loader with the
* following priority:
*
@tejacques
tejacques / asynceval.js
Last active October 24, 2020 07:17
Async Polyfill for javascript using eval and async function transform
/* Idea for allowing async-style functions in vanilla JS
* This transforms a function which uses await into a function
* which returns an ES6-style promise
*
* eval has the property of running the string of javascript
* with the same closure scope chain as the method it is called
* from, which is why it is necessary to call eval on the output
* of the async function, which returns a string representing
* the transformed function.
*/
@tejacques
tejacques / ExceptLastLinq.cs
Created March 10, 2014 03:55
IEnumerable extension for all but the last n elements of a sequence.
namespace System.Linq
{
public static class ExceptLastLinq
{
public static IEnumerable<T> ExceptLast<T>(
this IEnumerable<T> source)
{
if (source == null)
throw new ArgumentNullException("source");
public static class Extensions
{
public static async Task ForEachAsync<T, U>(this IEnumerable<T> collection, Func<T, Task<U>> body, IObserver<U> observer = null)
{
foreach (var item in collection)
{
var res = await body(item);
if (null != observer)
{
observer.OnNext(res);
@tejacques
tejacques / RPCDemo.cs
Last active October 26, 2020 23:06
C# Async Mini RPC Demo
using ServiceStack.Text;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
@tejacques
tejacques / TestRuntimes.cs
Last active December 19, 2015 10:29
Test the execution time of task wrapping / waiting vs. AsyncBrdige.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using AsyncBridge;
using System.Diagnostics;
namespace AsyncTests
@tejacques
tejacques / .bashrc
Last active December 16, 2015 00:29
.bashrc file with prompt coloring, check / x mark for success / failure, number of jobs running, and directory, and writing the current running application to the screen window name using escape characters.
# .bashrc
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)