Skip to content

Instantly share code, notes, and snippets.

View c0bra's full-sized avatar

Brian Hann c0bra

View GitHub Profile
var chain = [serverRequest, undefined];
var dummyP = $q.defer();
var promise = dummyP.promise; // $q.when(config);
// apply interceptors
forEach(reversedInterceptors, function(interceptor) {
if (interceptor.request || interceptor.requestError) {
chain.unshift(interceptor.request, interceptor.requestError);
}
@c0bra
c0bra / gist:5570879
Last active December 17, 2015 07:09
$scope.sections = Section.query({projectId: $scope.currentProject.id}, function(data) {
angular.forEach(data, function(section) {
$scope.$watch(section, function() {
section.$save();
}, true);
});
});
@c0bra
c0bra / gist:5568672
Last active December 17, 2015 06:49
<div ng-switch="user.type">
<div ng-switch-when="user" ng-include="/path/to/template.html" ng-controller="UserCtrl"></div>
<div ng-switch-when="professional" ng-include="/path/to/template.html" ng-controller="AdminProfessionalCtrl"></div>
</div>
var a = {'info' : 'testBuild'};
var b = {'info' : 'testBuild'};
a == b;
@c0bra
c0bra / exchange.json
Created March 4, 2013 19:41
Docpad exchange.json with https:// skeleton repo urls
{
"skeletons": {
"HTML5 Boilerplate": {
"branch": "docpad-6.x",
"repo": "https://github.com/docpad/html5-boilerplate.docpad.git",
"description": "HTML5 Boilerplate skeleton for DocPad. Bare essentials for building a modern website with best practices."
},
"HTML5 Boilerplate with Grunt": {
"branch": "master",
"repo": "https://github.com/lukekarrys/html5-boilerplate.docpad.git",
@c0bra
c0bra / autoagegate.user.js
Created March 15, 2012 16:14
Greasemonkey script to auto-bypass brewing company website age gates
// ==UserScript==//
// @name Brewing Company Site Auto Age Gate
// @namespace https://gist.github.com/2045030
// @description Automatically bypass brewing company website age gates
// @include http://*newbelgium.com*
// @include http://*stonebrew.com*
// @include http://*boulevard.com*
// @include http://*sierranevada.com*
// @include http://*samueladams.com*
// @include http://*lagunitas.com*
@c0bra
c0bra / perldancer_wordcloud.pl
Created March 7, 2012 21:46
Make a wordcloud out of the testimonials of Dancer users
#!perl
use strict;
use warnings;
use Image::WordCloud;
use File::Slurp;
use LWP::Simple;
use HTML::Grabber;