Skip to content

Instantly share code, notes, and snippets.

View tedkulp's full-sized avatar

Ted Kulp tedkulp

View GitHub Profile
@tedkulp
tedkulp / after_chaining.js
Last active August 29, 2015 14:03
Code for "A few reasons to use Underscore.js (or Lo-Dash)"
function capAndJoinWords(aryOfWords) {
return _.chain(aryOfWords)
.map(function(item) { return item + '123'; })
.map(function(item) { return item.toUpperCase(); })
.reverse()
.value()
.join(' ');
}
capAndJoinWords(['array', 'this', 'in', 'are', 'words', 'test']); // "TEST123 WORDS123 ARE123 IN123 THIS123 ARRAY123"
_ = require('lodash')
rpc = require('amqp-rpc').factory
url: "amqp://admin:changeme@192.168.100.10:5672"
exchange: "rpc_exchange"
rpc.on 'echo.*', (params, cb, callInfo) ->
if params.message
reply = {
echo: true
message: params.message
@tedkulp
tedkulp / app.rb
Created June 11, 2014 20:09
Ruby version
#!/usr/bin/env ruby
# encoding: utf-8
require 'rubygems'
require 'amqp'
require 'json'
EventMachine.run do
connection = AMQP.connect(:host => '192.168.100.10', :user => 'admin', :password => 'changeme')
@tedkulp
tedkulp / app.go
Created June 11, 2014 11:50
AMQP echo server in Go
package main
import (
"github.com/streadway/amqp"
"encoding/json"
"log"
"os"
"fmt"
"time"
)
@tedkulp
tedkulp / keybase.md
Last active June 23, 2020 09:22
keybase.md

Keybase proof

I hereby claim:

  • I am tedkulp on github.
  • I am tedkulp (https://keybase.io/tedkulp) on keybase.
  • I have a public key whose fingerprint is AE6B 007E 2FAB 1C94 319C 7C09 FD56 BE79 CDAE 7895

To claim this, I am signing this object:

@tedkulp
tedkulp / base-view.js
Created January 22, 2014 16:50
How we add common functionality to different extended Marionette classes.
Module.WreqrMixin = function(obj) {
return _.extend(obj, {
setupWreqr: function() {
var _this = this;
this.reqres = new Backbone.Wreqr.RequestResponse();
this.commands = new Backbone.Wreqr.Commands();
this.request = function() {
return _this.reqres.request.apply(_this.reqres, arguments);
@tedkulp
tedkulp / main.cf
Created November 5, 2013 01:55
Postfix Config for forwarding email
# Default file for /etc/postfix/main.cf
# Append this to the bottom for the domains we're virtualizing
virtual_alias_domains = domain.com anotherdomain.com
virtual_alias_maps = hash:/etc/postfix/virtual
@tedkulp
tedkulp / iterm.vim
Last active December 27, 2015 07:49
Getting c-space and s-space working on console vim with iterm2.
:map ✠ <S-Space>
:map! ✠ <S-Space>
:vmap ✠ <S-Space>
:map ✡ <C-Space>
:map! ✡ <C-Space>
:vmap ✡ <C-Space>
// Configure installed adapters
// If you define an attribute in your model definition,
// it will override anything from this global config.
module.exports.adapters = {
// If you leave the adapter config unspecified
// in a model definition, 'default' will be used.
'default': 'mongo',
// In-memory adapter for DEVELOPMENT ONLY
@tedkulp
tedkulp / Procfile
Last active January 6, 2020 06:33
Node.js server to turn twitter favorites into an RSS feed. Twitter api v1.1 is killing this, so I made my own and put it on heroku.
web: coffee app.coffee