Skip to content

Instantly share code, notes, and snippets.

View joshperry's full-sized avatar
😝

Joshua Perry joshperry

😝
View GitHub Profile
'use strict';
describe('Main Application Module', function() {
var httpProvider, $rootScope;
beforeEach(module('sawebApp', function($httpProvider) {
httpProvider = $httpProvider;
}));
beforeEach(inject(function(_$rootScope_) {
$rootScope = _$rootScope_;
angular.module('pslm')
.directive('pdkNextInputOnEnter', function() {
var includeTags = ['INPUT', 'SELECT'];
function link(scope, element, attrs) {
element.on('keydown', function (e) {
// Go to next form element on enter and only for included tags
if (e.keyCode == 13 && includeTags.indexOf(e.target.tagName) != -1) {
// Find all form elements that can receive focus
var focusable = element[0].querySelectorAll('input,select,button,textarea');
@joshperry
joshperry / Angular-Bootstrap Collapse
Created February 19, 2014 03:11
Twitter Bootstrap Unobtrusive Navbar Collapse vs. Angular-UI Bootstrap Navbar Collapse
<div class="navbar navbar-default navbar-static-top" ng-controller="NavbarCtrl">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" ng-click="isCollapsed = !isCollapsed">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<img src="images/pdk-logo-med.png" class="navbar-brand" />
@joshperry
joshperry / relay-client.js
Created August 30, 2013 16:14
TCP Relay System using node.js from http://delog.wordpress.com/2011/07/19/a-tcp-relay-mechanism-with-node-js/ I would like to modify the design to have a control port to request a new socket from the server instead of having it just spin one up preemptively.
var argv = require("optimist").argv;
console.log(argv);
var net = require("net");
function connect() {
var relaySocket = new net.Socket();
var onceOnly = true;
relaySocket.connect(argv.rp, argv.rh, function() {