Skip to content

Instantly share code, notes, and snippets.

View joshperry's full-sized avatar
😝

Joshua Perry joshperry

😝
View GitHub Profile
@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" />
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');
'use strict';
describe('Main Application Module', function() {
var httpProvider, $rootScope;
beforeEach(module('sawebApp', function($httpProvider) {
httpProvider = $httpProvider;
}));
beforeEach(inject(function(_$rootScope_) {
$rootScope = _$rootScope_;
<log4net>
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<immediateFlush value="true" />
<file value="pdk.log"/>
<appendToFile value="true" />
<maximumFileSize value="100KB" />
<maxSizeRollBackups value="1" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{yyyy-MM-dd hh:mm:ss} %level %thread %logger - %message%newline" />
'use strict';
angular.module('sawebApp')
.directive('pdkFilesSelected', function($parse) {
return {
restrict: 'A',
link: function(scope, elm, attrs) {
var onSelected = $parse(attrs.pdkFilesSelected);
elm.on('change', function() {
scope.$apply(function() {
Subscription sub = new Subscription
{
Title = "Accidental Tech Podcast",
Description = "Nerd stuff"
};
var result = await App.db.InsertAsync(sub);
Debug.WriteLine("{0} : {1} {2}", sub.Id, sub.Title, sub.Description);
public class Episode
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
[Indexed]
public int SubscriptionId { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public string Content { get; set; }
public string Guid { get; set; }
public function getRecentEpisodes()
{
$podcastid = Input::get('podcast_id');
$podcast = Podcast::find($podcastid);
// If we don't have any epsisodes, we need to import them for the feed
$this->episodesController->importEpisodes($podcast);
// Now let's collect our episodes
'use strict';
angular.module('saidpApp')
.directive('ngDebounce', function ($timeout) {
return {
restrict: 'A',
require: '?ngModel',
priority: 99,
link: function (scope, elm, attr, ngModel) {
if (!ngModel || attr.type === 'radio' || attr.type === 'checkbox') {
@joshperry
joshperry / gist:b32559be5a2e05d51c53
Created October 8, 2014 21:43
HTTP client proxy
var http = require('http'),
EventEmitter = require('event').EventEmitter,
httpProxy = require('http-proxy');
var proxyAgent = new http.Agent({ maxSockets: 3 });
proxyAgent.createConnection = function(options) {
var clientSocket = registry.getSocket(options.servername);
if(!clientSocket) {
// Set clientSocket to a future Socket here somehow