Skip to content

Instantly share code, notes, and snippets.

View pjsvis's full-sized avatar

Peter John Smith pjsvis

  • Virtual Information Systems
  • Edinburgh
View GitHub Profile
IEnumerable<IEnumerable<int>> GenerateCage(int num, int target, params int[] excluded)
{
return GenerateCageInner(num, target, 1, 9, new HashSet<int>(excluded));
}
private IEnumerable<IEnumerable<int>> GenerateCageInner(int num, int target, int min, int max, HashSet<int> excluded)
{
// Base case
if (num == 0)
{
angular.module('app', ['jmdobry.angular-cache']).config(function ($angularCacheProvider) {
// optionally set cache defaults
$angularCacheFactoryProvider.setCacheDefaults({ options... });
}).run(function ($angularCacheFactory) {
// Create a cache here, or anywhere else. Just inject $angularCacheFactory
var newCache = $angularCacheFactory('newCache', { options... });
@pjsvis
pjsvis / gist:7453183
Created November 13, 2013 17:42
Modified gruntfile.js from generator-cg-angular
'use strict';
var path = require('path');
var folderMount = function folderMount(connect, point) {
return connect.static(path.resolve(point));
};
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
@pjsvis
pjsvis / gist:6320268
Created August 23, 2013 14:55
An angular directive to wrap Dan Grossman's excellent date range picker ref https://github.com/dangrossman/bootstrap-daterangepicker
angular.module('daterangepicker', []);
angular.module('daterangepicker').directive('dgDaterangepicker', [function () {
'use strict';
return{
restrict: 'A',
link: function (scope, elem, attrs) {
var options = attrs.options;
var parseOptions = function (options) {
if (!options) return;
@pjsvis
pjsvis / gist:6210002
Last active November 13, 2020 00:56
Angular directive for jQuery sparkline
// Requires jQuery from http://jquery.com/
// and jQuerySparklines from http://omnipotent.net/jquery.sparkline
// AngularJS directives for jquery sparkline
angular.module('sparkline', []);
angular.module('sparkline')
.directive('jqSparkline', [function () {
'use strict';
return {
@pjsvis
pjsvis / gist:5642417
Last active December 17, 2015 16:59
flot.line.js
angular.module('flot')
.directive('flotLine', [function () {
'use strict';
return {
restrict: 'EA',
require: 'ngModel',
link: function (scope, elem, attrs, ngModel) {
var chart = null,
opts = {
@pjsvis
pjsvis / gist:5642410
Last active December 17, 2015 16:59
jquery.flot.stackedline directive
angular.module('flot')
.directive('flotStackedline', [function () {
'use strict';
return {
restrict: 'EA',
require: 'ngModel',
link: function (scope, elem, attrs, ngModel) {
var chart = null,
opts = {
@pjsvis
pjsvis / gist:5642407
Last active December 17, 2015 16:59
jquery.flot.pie directive
angular.module('flot')
.directive('flotPie', [function () {
'use strict';
return {
restrict: 'E,A',
require: 'ngModel',
link: function (scope, elem, attrs, ngModel) {
var chart = null,
opts = {
@pjsvis
pjsvis / gist:5642393
Last active December 17, 2015 16:59
Module definition for flot
// AngularJS directives for jquery.flot
// Dependencies jQuery and flot (http://www.flotcharts.org)
// jquery.flot.plugins: jquery.flot.pie.js, jquery.flot.stack.js, jquery.flot.time.js
angular.module('flot', []);
// AngularJS Directive for jQuery Sparklines
// Dependencies: jquery and http://omnipotent.net/jquery.sparkline/
angular.module('sparkline',[])
angular.module('sparkline')
.directive('jqSparkline', [function () {
'use strict';
return {
restrict: 'E,A',
require: 'ngModel',