Skip to content

Instantly share code, notes, and snippets.

View christophermina's full-sized avatar

Christopher Mina christophermina

  • CMConsulting LLC
  • Boulder, CO
View GitHub Profile
@christophermina
christophermina / MazeHasExit.js
Last active December 27, 2015 08:08
Given some parameters to create a maze out of a grid of 0's and 1's, determines if we can get from a start point to an exit.
/**
* The purpose of this is to randomly generate a grid of preset height and width (dimensionX, dimensionY)
* with each cell either a 0 or a 1. There is a randomly assigned start and exit position, and you must
* determine if, by following a trail of contiguous ones in the up, down, left, right positions, you can
* get from the start to the exit.
*
* Assumptions:
* 1. the start coordinates fall within valid grid
* 2. You can only move up, down, left, right
* 3. You cannot jump a 0.
var lastHeights = [];
var i;
for (i = 0; i < this.numColumn; i++) {
lastHeights[i+1] = this.gapMargin;
}
if (cardElems.length > 0) {
var x
, y
, l
define([
'/path/to/a/dependency'
], function(myDependcy) {
var module = angular.module('asyncModule', [myDependency.name]);
module.directive('asyncDirective', ['$http'', function($http) {
return {
link: function(scope, element, attrs) {
define([
'bower_packages/ocLazyLoad/dist/ocLazyLoad'
], function() {
var module = angular.module('mainApp', ['oc.lazyload']);
module.config(['$ocLazyLoadProvider', function ($ocLazyLoadProvider) {
$ocLazyLoadProvider.config({
loadedModules: ['mainApp'],
asyncLoader: require
getSignedRequest: function(container, resourceKey, expirationTimeInSeconds, fn) {
if (_.isFunction(expirationTimeInSeconds)) {
fn = expirationTimeInSeconds;
expirationTimeInSeconds = 3600;
}
if (process.env.SL_STORAGE_URL == null) {
request.get(slConfigs.SL_STORAGE_AUTH_URL_V1, {
headers: {
'X-Auth-User':slConfigs.SL_STORAGE_USERNAME,
var post = request.post(storageUrl, {
headers: {
'X-Auth-User': slConfigs.SL_STORAGE_USERNAME,
'X-Auth-Token': token,
'X-Account-Meta-Temp-Url-Key': slConfigs.SL_TEMP_URL_KEY
}
}, function(err, value) {
if (value.statusCode == 204) {
return fn(null, "OK")
_getClient: function() {
return pkgcloud.storage.createClient({
provider: 'openstack',
username: slConfigs.SL_STORAGE_USERNAME,
password: slConfigs.SL_STORAGE_PASS,
authUrl: slConfigs.SL_STORAGE_AUTH_URL,
version: 1,
useServiceCatalog: false
});
}
var request = require('request');
request.get(slConfigs.SL_AUTH_URL_V1, {
headers: {
'X-Auth-User':slConfigs.SL_STORAGE_USERNAME,
'X-Auth-Key':slConfigs.SL_STORAGE_PASS
}
}, function(err, value) {
if (value.statusCode == 200) {
var token = value.headers['x-auth-token'];
public class Global : System.Web.HttpApplication
{
private static MSLogger log = MSLogger.GetLogger(typeof(Global));
public Global()
{
}
@christophermina
christophermina / gist:4138575
Created November 24, 2012 05:39
Example function for R support
line.plot.fun<-function(data1, space.columns=1,
num.major.horiz=4,
num.major.verts=5,
x.unit="Month of Year",
new.x.vals=FALSE,
line.width=3,
line.type=1, ylab="set y label in params",
xlab="Month of year",