This file contains hidden or 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
| // loop through the 'paper' variable from Raphael JS and build up the JSON object describing all images and paths within it. | |
| buildJSON = function(paper) { | |
| var svgdata = []; | |
| svgdata.push({ | |
| width: 390, | |
| height: 400 | |
| }); | |
| $.each(paper, |
This file contains hidden or 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
| # | |
| # Wide-open CORS config for nginx | |
| # | |
| location / { | |
| if ($request_method = 'OPTIONS') { | |
| add_header 'Access-Control-Allow-Origin' '*'; | |
| # |
This file contains hidden or 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
| This example expects to have d3.min.js and d3.layout.min.js in the same directory as pie.js and pie_serv.js. | |
| Run with node pie_serv.js |
This file contains hidden or 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
| app.use(express.methodOverride()); | |
| // ## CORS middleware | |
| // | |
| // see: http://stackoverflow.com/questions/7067966/how-to-allow-cors-in-express-nodejs | |
| var allowCrossDomain = function(req, res, next) { | |
| res.header('Access-Control-Allow-Origin', '*'); | |
| res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE'); | |
| res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization'); | |
This file contains hidden or 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 parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |
This file contains hidden or 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
| void function() {//closure | |
| var global = this | |
| , _initKeyboardEvent_type = (function( e ) { | |
| try { | |
| e.initKeyboardEvent( | |
| "keyup" // in DOMString typeArg | |
| , false // in boolean canBubbleArg | |
| , false // in boolean cancelableArg | |
| , global // in views::AbstractView viewArg |
This file contains hidden or 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
| function dataURItoBlob(dataURI, callback) { | |
| // convert base64 to raw binary data held in a string | |
| // doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this | |
| var byteString = atob(dataURI.split(',')[1]); | |
| // separate out the mime component | |
| var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0] | |
| // write the bytes of the string to an ArrayBuffer | |
| var ab = new ArrayBuffer(byteString.length); |
This file contains hidden or 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
| (function() { | |
| var script, | |
| scripts = document.getElementsByTagName('script')[0]; | |
| function load(url) { | |
| script = document.createElement('script'); | |
| script.async = true; | |
| script.src = url; | |
| scripts.parentNode.insertBefore(script, scripts); |
This file contains hidden or 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 homeModule = angular.module('HomeModule', []); | |
| homeModule.filter('titleCase', function () { | |
| return function (input) { | |
| var words = input.split(' '); | |
| for (var i = 0; i < words.length; i++) { | |
| words[i] = words[i].charAt(0).toUpperCase() + words[i].slice(1); | |
| } | |
| return words.join(' '); | |
| } |
This file contains hidden or 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
| if (moment().quarter() == 4) { | |
| var current_fiscal_year_start = moment().month('October').startOf('month'); | |
| var current_fiscal_year_end = moment().add('year', 1).month('September').endOf('month'); | |
| var last_fiscal_year_start = moment().subtract('year', 1).month('October').startOf('month'); | |
| var last_fiscal_year_end = moment().month('September').endOf('month'); | |
| } else { | |
| var current_fiscal_year_start = moment().subtract('year', 1).month('October').startOf('month'); | |
| var current_fiscal_year_end = moment().month('September').endOf('month'); | |
| var last_fiscal_year_start = moment().subtract('year', 2).month('October').startOf('month'); | |
| var last_fiscal_year_end = moment().subtract('year', 1).month('September').endOf('month'); |
OlderNewer