Skip to content

Instantly share code, notes, and snippets.

@davemo
davemo / api.proxy.server.js
Created Nov 6, 2012
A simple express.js server with a proxy that intercepts all requests with /api/ and proxies them to localhost:3000
View api.proxy.server.js
var express = require('express'),
httpProxy = require('http-proxy'),
app = express();
var proxy = new httpProxy.RoutingProxy();
function apiProxy(host, port) {
return function(req, res, next) {
if(req.url.match(new RegExp('^\/api\/'))) {
proxy.proxyRequest(req, res, {host: host, port: port});
View systems-engineer-learning-resources.md

So, You Want to be a Systems Engineer

Systems Engineering (also known as Infrastructure Engineering, Operations Engineering, or DevOps) is a challenging but rewarding career path. Because Systems Engineering draws from a wide variety of smaller topics, it can be hard to know where to start and in what order to begin. This resource is intended to give you a sketch of some of the learning-paths that that can lead you to a career in Systems Engineering.

What do I need to know?

To start, let's examine a high-level list of topics that established systems engineers should have knowledge of. In each of these topics, the level of depth required to get started as a systems engineer may vary, but it's good to have a general breadth of knowledge on all of these topics.

These lists are not exhaustive, rather a good starting point to gain general knowledge.

@davemo
davemo / bump.sh
Created Apr 12, 2017
bumps versions, tags and pushes with git
View bump.sh
#!/bin/bash
# works with a file called VERSION in the current directory,
# the contents of which should be a semantic version number
# such as "1.2.3"
NOW="$(date +'%B %d, %Y')"
RED="\033[1;31m"
GREEN="\033[0;32m"
YELLOW="\033[1;33m"
@davemo
davemo / app.coffee
Last active Mar 25, 2020
Got a .coffee file with JSX? Here's how you can transpile to .js with Reacts JSX parsed.
View app.coffee
`/** @jsx React.DOM */`
converter = new Showdown.converter
Comment = React.createClass
render: ->
rawMarkup = converter.makeHtml @props.children.toString()
`<div className="comment">
<h2 className="comment">{this.props.author}</h2>
<span dangerouslySetInnerHTML={{__html: rawMarkup}} />
@davemo
davemo / ottawa.js.panel.questions.feb.11.2015.md
Last active Aug 28, 2019
Ottawa-JS-Dev-JavaScript-Panel
View ottawa.js.panel.questions.feb.11.2015.md

Ottawa JS, February 11, 2015

Your best advice for people getting started in JavaScript:

Dan:

The Other Simon:

@davemo
davemo / CaptureScreen.cs
Created Apr 25, 2012
Gets input from a Vuforia AR Camera and assigns it to a UnityEngine.Texture2D
View CaptureScreen.cs
using UnityEngine;
using System.Collections;
using System.IO;
using MultiFormatReader = com.google.zxing.MultiFormatReader;
public class TakeScreenshot : MonoBehaviour {
public GUITexture mainProduct;
private MultiFormatReader reader;
@davemo
davemo / haml2erb.md
Created Jan 30, 2019
Convert HAML to ERB across a folder on Mac OS
View haml2erb.md

steps

  1. install herbalizer somewhere on your PATH, i put mine in ~/bin

cd ~/bin && wget http://openmbta.org/herbalizer && chmod +x herbalizer

  1. do a dry run to see if your renames look ok

find . -name '*haml' | xargs ruby -e 'ARGV.each { |i| puts "herbalizer < #{i} > #{i}.erb" }'

@davemo
davemo / this.problem.txt
Created Mar 31, 2012
Crockford on the "This" problem in JavaScript
View this.problem.txt
When a function is called with the function invocation pattern, its this is not bound to the outer
function’s this as we would hope, but is instead bound to the global object, which is horrible.
The workarounds for this include the use of bind functions and riddles like:
var that = this;
~ Douglas Crockford (http://www.yuiblog.com/blog/2012/03/30/what-is-the-meaning-of-this)
View howto.git.on.windows.7.txt
My Dev Workflow from OS X on Windows 7
1. Install Console 2 and configure as per http://www.hanselman.com/blog/Console2ABetterWindowsCommandPrompt.aspx
You can skip the steps on Tabs and Powershell, but I do like his fancy icons :)
2. Install Git for windows http://git-scm.com/download/win
Now comes the fun part, after you have configured Console2 and installed the Windows git binary you'll want to link the Console2 tab that opens such that it is in the context of the git-bash cmd, how do we do this? Easy:
@davemo
davemo / Cross Table Drag Drop.html
Created Nov 19, 2010
This works for dragging, dropping table rows between two separate tables across most browsers :)
View Cross Table Drag Drop.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>untitled</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="David Mosher">
<!-- Date: 2010-11-18 -->