Skip to content

Instantly share code, notes, and snippets.

View c0bra's full-sized avatar

Brian Hann c0bra

View GitHub Profile
@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;
@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 / 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",
var a = {'info' : 'testBuild'};
var b = {'info' : 'testBuild'};
a == b;
@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>
@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);
});
});
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);
}
jade: {
build: {
options: {
pretty: true
},
files: [
{
expand: true,
src: '<%= src.jade %>',
cwd: 'src/',
@c0bra
c0bra / gist:5859295
Created June 25, 2013 15:15
ngVisible angular directive
.directive('ngVisible', function () {
return function (scope, element, attr) {
scope.$watch(attr.ngVisible, function (visible) {
element.css('visibility', visible ? 'visible' : 'hidden');
});
};
})
@c0bra
c0bra / gist:7550460
Last active December 28, 2015 19:29
// Grunt task:
karma: {
unit: {
configFile: 'test/karma.config.js',
background: true
}
},
// test/karma.config.js
module.exports = function(config) {