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
<!DOCTYPE html> | |
<html ng-app="plunker"> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/restangular/1.3.1/restangular.min.js" type="text/javascript"></script> | |
<script data-require="lodash.js@*" data-semver="2.4.1" src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script> | |
<meta charset="utf-8" /> | |
<title>AngularJS Plunker</title> | |
<script>document.write('<base href="' + document.location + '" />');</script> |
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
<link rel="import" href="../paper-tabs/paper-tab.html"> | |
<link rel="import" href="../core-pages/core-pages.html"> | |
<link rel="import" href="../core-icon-button/core-icon-button.html"> | |
<link rel="import" href="../core-toolbar/core-toolbar.html"> | |
<link rel="import" href="../core-item/core-item.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> |
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 should = require('chai').should, | |
assert = require('chai').assert,*/ | |
var should = require('should'), | |
assert = require('assert'), | |
request = require('supertest'); | |
describe('Blogs', function(){ | |
//our test blogs | |
var blog = { |
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 Schema = mongoose.Schema; | |
//validation rule | |
function validator(val){ | |
if(val != 'red'){ | |
return true | |
} | |
return false; | |
} |
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
Show hidden characters
{ | |
"scope": "source.js", | |
"completions": | |
[ | |
{ "trigger": "console.log", "contents": "console.log(${1})" }, | |
{ "trigger": "console.table", "contents": "console.table(${1})" }, | |
{ "trigger": "console.dir", "contents": "console.dir(${1})" }, | |
{ "trigger": "iferr", "contents": "if(err){${1}}" } | |
] |
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
//header required | |
/* | |
Authorization Basic:<base64encoded(<APIkey>:<password>)> | |
Content-Type application/json | |
charset utf-8 | |
*/ | |
//POST to: https://api.sandbox.ewaypayments.com/DirectPayment.json | |
//payload |
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
//header required | |
/* | |
Authorization Basic:<base64encoded(<APIkey>:<password>)> | |
Content-Type application/json | |
charset utf-8 | |
*/ | |
//POST to: https://api.sandbox.ewaypayments.com/DirectPayment.json | |
//payload |
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
//As Node doesn't have any internationalization included .toLocaleString() wont work. | |
//either install intl (npm install intl) or use a function like below | |
_toMoney = function(number) { | |
var integer = number.toString().split('.')[0]; | |
var decimal = _getDecimal(number); | |
integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, ","); | |
if( !decimal || !decimal.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
/* | |
var todayUTC = new Date('25 July 2015 8:00 UTC'); | |
var todayMel = new Date('25 July 2015 8:00 +10'); //illegal use!? | |
console.log(todayUTC.toISOString()); | |
console.log(todayMel.toISOString()); | |
console.log(todayUTC.toLocaleString('en-AU')) | |
console.log(todayMel.toLocaleString('en-AU')) | |
*/ |
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 fisherYatesShuffle(array) { | |
var currentIndex = array.length | |
, temporaryValue | |
, randomIndex | |
; | |
// While there remain elements to shuffle... | |
while (0 !== currentIndex) { | |
// Pick a remaining element... |
OlderNewer