Skip to content

Instantly share code, notes, and snippets.

View mralexgray's full-sized avatar

Alex Gray mralexgray

View GitHub Profile
@mralexgray
mralexgray / Brewfile
Last active April 20, 2020 04:36 — forked from codeinthehole/osx_bootstrap.sh
Script to install stuff I want on a new OSX machine
tap "caskroom/cask"
tap "denji/nginx"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/cask-versions"
tap "homebrew/core"
tap "homebrew/dupes"
tap "homebrew/services"
tap "mongodb/brew"
@mralexgray
mralexgray / gist:eac81b64f30d19ac2b0086fabe286f9b
Created November 10, 2019 00:14 — forked from howlingblast/gist:5814547
CoffeeScript: getter/setter example
Function::property = (prop, desc) ->
Object.defineProperty @prototype, prop, desc
class Person
constructor: (@firstName, @lastName) ->
@property 'fullName',
get: -> "#{@firstName} #{@lastName}"
set: (name) -> [@firstName, @lastName] = name.split ' '
p = new Person 'Leroy', 'Jenkins'
@mralexgray
mralexgray / he-dns-update.sh
Created March 23, 2017 16:09 — forked from joemiller/he-dns-update.sh
script for updating dynamic DNS records on he.net (hurricane electric)
#!/bin/bash
#
# Script for updating DNS records on Hurricane Electirc's DNS system (https://dns.he.net).
#
# The record will be updated with the IP address that originates the request.
#
# Usage
# -----
#
# Create config file `/etc/he-dns-update.conf`:
@mralexgray
mralexgray / .gitignore
Created February 16, 2017 20:52 — forked from bergie/.gitignore
Node.js email handling examples
config.json
reading-image.png
@mralexgray
mralexgray / proxy.coffee
Last active July 11, 2016 05:05 — forked from richardkazuomiller/proxy.js
node-http-proxy routing proxy with websockets
httpProxy = require 'http-proxy'
proxy = httpProxy.createProxy ws:true
options =
'herp.dev': 'http://0.0.0.0:9008'
'derp.dev': 'http://0.0.0.0:3000'
server = require('http').createServer (req, res) ->
proxy.web req, res, { target: options[req.headers.host] }, (e) ->
log_error e, req
log_error = (e, req) -> return if not e
@mralexgray
mralexgray / cs-jq-plugin-template.coffee
Last active June 9, 2016 03:24 — forked from rjz/cs-jq-plugin-template.coffee
Coffeescript jQuery Plugin Class Template
# A class-based template for jQuery plugins in Coffeescript
#
# $('.target').myPlugin({ paramA: 'not-foo' });
# $('.target').myPlugin('myMethod', 'Hello, world');
#
# Check out Alan Hogan's original jQuery plugin template:
# https://github.com/alanhogan/Coffeescript-jQuery-Plugin-Template
#
do($ = window.jQuery, window) ->
@mralexgray
mralexgray / switchs.h
Created February 19, 2016 00:19 — forked from develhox/switchs.h
Switch operand implementation for the strings
#ifndef __SWITCHS_H__
#define __SWITCHS_H__
#include <string.h>
#include <regex.h>
#include <stdbool.h>
/** Begin a switch for the string x */
#define switchs(x) \
{ char *__sw = (x); bool __done = false; bool __cont = false; \
@mralexgray
mralexgray / 0x00000.bin
Created January 3, 2016 08:36 — forked from ajfisher/0x00000.bin
ESP8266 Transparent bridge to J5
@mralexgray
mralexgray / nodobjc.blocks.coffee
Last active December 15, 2015 04:49 — forked from thomaswrenn/index.js
NodObjC works with ObjC Blocks
$ = require 'nodobjc'
$.import 'Foundation'
$.NSAutoreleasePool 'new'
randChar = -> $(String.fromCharCode Math.round(Math.random() * 26) + 'a'.charCodeAt 0 )
array = $.NSMutableArray 'new'
array 'addObject', randChar() for i in [1..10]