Skip to content

Instantly share code, notes, and snippets.

View brentjanderson's full-sized avatar

Brent Anderson brentjanderson

View GitHub Profile
@brentjanderson
brentjanderson / keybase.md
Created March 1, 2014 07:29
Verification for Keybase

Keybase proof

I hereby claim:

  • I am brentjanderson on github.
  • I am bja (https://keybase.io/bja) on keybase.
  • I have a public key whose fingerprint is D359 6E7E B5E2 E574 AD75 B1BF 17EB 15C0 C056 E7BF

To claim this, I am signing this object:

# How to upload local db to meteor:
# -h = host, -d = database name, -o = dump folder name
mongodump -h 127.0.0.1:3002 -d meteor -o meteor
# get meteor db url, username, and password
meteor mongo --url myapp.meteor.com
# Response will be something like this:
# mongodb://client:f8f6d5aa-1213-008f-31c8-e9e059515615@production-db-a3.meteor.io:27017/myapp_meteor_com
@brentjanderson
brentjanderson / Controller.php
Created July 11, 2012 19:54
Yii Framework cache busting with Git and some magic page post-processing.
public function processOutput($output) {
$output = parent::processOutput($output);
$output = str_replace('.css', '.css?' . Yii::app()->params['git-hash'], $output);
$output = str_replace('.js', '.js?' . Yii::app()->params['git-hash'], $output);
return $output;
}
@brentjanderson
brentjanderson / app.js
Created December 19, 2012 19:53
An assets management module with convenience methods for quickly creating the objects you actually want to use. Includes Handlebars support through a helper function `asset` which can be used like `{{{asset '/app.js'}}}` to generate the correct link to the correct asset.
var express = require('express')
, http = require('http')
, hbs = require('hbs')
, assets = require('./assets');
var app = express();
app.configure(function(){
app.set('port', process.env.PORT || 3000);
// Setup views using handlebars
@brentjanderson
brentjanderson / client.js
Last active December 14, 2015 01:59
Cocoaheads NeuNode demo. Get the repo: https://github.com/snakajima/neunode
// Paste this into one of the *.js files in the NeuNode project
var net = require('net');
var client = net.connect({port: 1337, host:'10.24.11.168'}, function() { //'connect' listener
console.log("Client connected");
});
client.on('data', function(data) {
console.log(data.toString());
});
client.on('end', function() {
@brentjanderson
brentjanderson / Vagrantfile
Created August 8, 2013 22:30
Vagrant configuration file for a jekyll installation.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.network :forwarded_port, host: 4000, guest: 4000
end
@brentjanderson
brentjanderson / ISC_LICENSE
Created January 28, 2018 03:08
Sample ISC License
Copyright 2018
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@brentjanderson
brentjanderson / .eslintrc.js
Created March 2, 2018 23:03
Standards .eslintrc.js
module.exports = {
env: {
es6: true,
node: true
},
plugins: ["prettier"],
extends: ["plugin:prettier/recommended"],
parserOptions: {
sourceType: "module"
},
@brentjanderson
brentjanderson / README.md
Last active June 8, 2018 19:41
Example Dockerfiles for phoenix app packaged with distillery (Production ready image and testing image)

Note that these dockerfiles depend on:

  • Having Docker installed on your machine
  • Rebuilding the image every time you want to try your latest code
  • Passing necessary environment variables when you docker run
  • Your app includes distillery and coveralls

Make modifications as needed to meet those requirements.

Note that multi-stage builds can be used to combine the prod and test files described below, I haven't updated the gist yet to reflect that option.

@brentjanderson
brentjanderson / adapter.js
Last active October 23, 2019 19:12
NOTE: Not updated since early 2013 - likely will not work with modern EmberData. Ember.JS, ember-data, and socket.io adapter. Not as primitive as the initial version and it supports object creation/deletion/etc. Does not support bulk updates like the first one just to keep it simple. Does support ember-data revision 11 and does support queries/f…
/*jshint browser:true */
/*global DS:true, io:true, App:true */
(function() {
'use strict';
// Initializer for Models
window.Models = {};
console.warn("Don't pollute the global namespace with Models!");