This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lastHeights = []; | |
var i; | |
for (i = 0; i < this.numColumn; i++) { | |
lastHeights[i+1] = this.gapMargin; | |
} | |
if (cardElems.length > 0) { | |
var x | |
, y | |
, l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_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 | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Global : System.Web.HttpApplication | |
{ | |
private static MSLogger log = MSLogger.GetLogger(typeof(Global)); | |
public Global() | |
{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", |
NewerOlder