Skip to content

Instantly share code, notes, and snippets.

View c0bra's full-sized avatar

Brian Hann c0bra

View GitHub Profile

Keybase proof

I hereby claim:

  • I am c0bra on github.
  • I am bhannman (https://keybase.io/bhannman) on keybase.
  • I have a public key ASAtthfP7ozPs_MEAMmOAVNNJZPQd_GaDhcOpqIE0KcAcQo

To claim this, I am signing this object:

@c0bra
c0bra / pre-commit
Created June 21, 2017 22:11
pre-commit hook to update and stage some files
#!/bin/sh
# Stash unstaged changes
git stash -q --keep-index
npm run build
npm run toc
# Stage changes
git add -u
Dim list As List(Of EXM_Spirometry)()
list.ForEach(Sub(x)
' Do whatever you want in this block.
End Sub)
const cluster = require('cluster');
const Benchmark = require('benchmark');
const chance = require('chance').Chance();
const smeans = require('../src/smeans');
let suite = new Benchmark.Suite();
// Generate dataset
let data;
if (cluster.isMaster) {
ADMIN="your-email@you.com"
# set alert level 90% is default
ALERT=90
df -H | grep -vE '^Filesystem|tmpfs|cdrom|^//|/mnt' | awk '{ print $5 " " $1 }' | while read output;
do
#echo $output
usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
partition=$(echo $output | awk '{ print $2 }' )
if [ $usep -ge $ALERT ]; then
echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)" |
/* js */
var app = angular.module('plunker', ['ngSanitize']);
app.controller('MainCtrl', function($scope, $sce) {
$scope.data = {};
$scope.val = $sce.trustAsHtml('🏠');
});
@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) {
@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');
});
};
})
jade: {
build: {
options: {
pretty: true
},
files: [
{
expand: true,
src: '<%= src.jade %>',
cwd: 'src/',
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);
}