Skip to content

Instantly share code, notes, and snippets.

View tracker1's full-sized avatar

Michael J. Ryan tracker1

View GitHub Profile
@tracker1
tracker1 / SocketDescriptorStream.cs
Created January 28, 2015 18:09
SharpDoorKit - start of a ,Net based door kit - C wrapper for socket descriptor
using System;
using System.Runtime.InteropServices;
using System.IO;
using System.Net.Sockets;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace SharpDoorKit {
public class SocketDescriptorStream : Stream {
@tracker1
tracker1 / mac-and-cheese.txt
Created January 28, 2015 22:22
Mac And Cheese
Tools:
Cheese grater
strainer (for pasta)
1.5 gallon + pot (for pasta)
2 quart sauce pan (for sauce)
2 quart casserole dish (for baking)
1 whisk for mixing
2 medium bowls (one for topping mix, the other for mixing the wet ingredients)
Ingredients:
@tracker1
tracker1 / getcookies.js
Created February 19, 2015 20:09
getcookies.js
//requires ES5, or a shimmed browser for map/reduce
module.exports = function getCookies() {
if (!(this.document && this.document.cookie)) return {}; //no cookies for you
return this.document.cookie.split(/;\s+/g)
.map(function(x){
var kv=x.match(/([^\=]*)\=(.*)/);
return [kv[1]||'',kv[2]||''].map(decodeURIComponent);
})
.reduce(
function(v,kv){
@tracker1
tracker1 / README.md
Last active August 29, 2015 14:16
environment variables for npm to use VS 2013

Building node.js / io.js binary modules in Windows

  • You will need the latest Python 2.7.x installed (Should install to C:\Python27\ and will set environment variables). You will need to close your command prompt and re-open for this change to take effect.
  • You should have a recent version of Visual Studio installed.
  • Because node-gyp defaults to expecting VS 2010, you can save your version configuration via npm...
    • npm config set msvs_version 2013
  • Alternatively, you can specify the version via the following environment variables
    • SET GYP_MSVS_OVERRIDE_PATH=true
  • SET GYP_MSVS_VERSION=2013
@tracker1
tracker1 / filter-etcd-config.js
Last active August 29, 2015 14:16
This is functional JavaScript - composition first
require('cc-globals'); //establishes fetch and R (ramda library) globally
//regular expression for valid etcd address
var address = /^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\:\d{1,5}$/;
//if the input is a string, makes it an array containing the string, otherwise returns the original input
var fixStr = (v) => typeof v === 'string' ? [v] : v;
//converts collection input to an array, returns empty array otherwise
var fixArray = (v) => v && v.length && Array.prototype.slice.call(v) || [];
@tracker1
tracker1 / keybase.md
Created March 13, 2015 18:27
keybase.md

Keybase proof

I hereby claim:

  • I am tracker1 on github.
  • I am tracker1 (https://keybase.io/tracker1) on keybase.
  • I have a public key whose fingerprint is A61A A793 9795 B51D 33FF C8DD 94C6 BAE3 A095 6216

To claim this, I am signing this object:

@tracker1
tracker1 / Global.asax.cs
Created June 26, 2015 18:42
Application_OnError Handler, take care of JS expected responses.
protected void Application_Error(object sender, EventArgs e)
{
var status = 500;
// Get the error details
var lastError = Server.GetLastError();
HttpException lastErrorWrapper = Server.GetLastError() as HttpException;
if (lastErrorWrapper != null)
{
@tracker1
tracker1 / post-object-from-form.js
Created August 7, 2015 23:25
Post JSON object as form
//assumes jQuery
import clone from 'safe-clone-deep'
import encode from './html-encode';
export default function postObjectFromForm(url, data, options = {}) {
data = clone(data);
//console.log('postObjectFromForm', {url, data, options});
var form = $(`<form method="post" action="${encode(url)}"></form>`);
if (options.target) form.attr('target', options.target);
@tracker1
tracker1 / sbbs-install-errors.log
Created August 14, 2015 04:14
sbbs install issues
This file has been truncated, but you can view the full file.
cvs checkout: Updating src/build
cvs checkout: Updating src/sbbs3
cvs checkout: Updating src/sbbs3/chat
cvs checkout: Updating src/sbbs3/ctrl
cvs checkout: Updating src/sbbs3/dosxtrn
cvs checkout: Updating src/sbbs3/execvxd
cvs checkout: Updating src/sbbs3/gtkchat
cvs checkout: Updating src/sbbs3/gtkmonitor
cvs checkout: Updating src/sbbs3/gtkmonitor/pixmaps
cvs checkout: Updating src/sbbs3/gtkuseredit
@tracker1
tracker1 / package.json
Created August 20, 2012 18:18
Setting the current date/time in windows.
{
"name":"update-dtm"
,"version":"0.1.0"
,"dependencies":{
"request":"2.x.x"
}
,"devDependencies":{}
}