Skip to content

Instantly share code, notes, and snippets.

View craigjbass's full-sized avatar
😁

Craig J. Bass craigjbass

😁
View GitHub Profile
@craigjbass
craigjbass / splicer.hs
Last active December 26, 2015 13:59
splicer :: [[a]] -> [[a]] such that the following holds true: splicer [ ['a', 'b'], ['c', 'd'], ['e', 'f'] ] => [ ['a', 'c', 'e'], ['b', 'd', 'f'] ] Useful for use in Vigenere cipher breakers.
-- such that the following holds true (where => indicates function output)
-- splicer [ ['a', 'b'], ['c', 'd'], ['e', 'f'] ] => [ ['a', 'c', 'e'], ['b', 'd', 'f'] ]
splicer :: [[a]] -> [[a]]
splicer [] = []
splicer (x:[]) = splitEvery 1 x
splicer (x:xs) = zipWith (:) x $ splicer xs
@craigjbass
craigjbass / ng-angular-element
Created July 11, 2014 13:25
Implements the converse to ng-non-bindable: "ng-bindable" (only compiles mark up within <angular> tags, this is useful for legacy applications which cannot have {'s and }'s escaped easily.)
angular.module( 'ng-angular-element', [] )
.directive( 'angular', function() { return { restrict: 'E' }; } )
.directive( 'html', ['$compile', '$rootScope', '$document',
function( $compile, $rootScope, $document ) {
return {
restrict: 'E',
compile: function(scope, element, attributes) {
angular.forEach( $document.find( 'angular' ), function( angularElement ) {
$compile(angularElement)($rootScope);
} );
@craigjbass
craigjbass / Devls_Enum.php
Last active August 29, 2015 13:56
PHP Enums
<?php
/**
* Enum Abstract Class
*
* Warning: Uses Reflection and LSB. :D
* ==========================================================
*
* To use this class:
*