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
<auth> | |
<login if={'login'==opts.action || 'logout' == opts.action} action={opts.action}></login> | |
<register if={'register' == opts.action}></register> | |
<change-pass if={'verifyEmail' == opts.action || 'changePass' == opts.action} action={opts.action} uid={opts.uid} data={opts.data}></changePass> | |
<script> | |
console.log(opts.action); | |
if(opts.action=='login' && Cookies.get('apiKey')) riot.route('myAccount'); | |
if(opts.action=='register' && Cookies.get('apiKey')) riot.route('myAccount'); | |
else if(opts.action=="" && Cookies.get('apiKey')) riot.route('myAccount'); |
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
<?php | |
$user="USER"; | |
$pass="PASS"; | |
include("SipSorcery.inc.php"); | |
ini_set('session.use_only_cookies',1); | |
ini_set('session.gc_maxlifetime',31557600); | |
session_set_cookie_params(24*24*60); | |
session_start(); | |
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
it('should round up to the next billing interval', function(){ | |
var cases = [//number, expect, increment | |
{ n: 4000, e: 6, i:6 }, | |
{ n: 6001, e: 12, i:6 }, | |
{ n: 17999, e: 18, i:6 }, | |
{ n: 1, e: 6, i:6 }, | |
{ n: 62000, e: 66, i:6 }, | |
{ n: 1, e: 1, i:1 }, | |
{ n: 62000, e: 120, i:60 }, | |
]; |
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
console.log("Bot Started..."); | |
process.on('uncaughtException', function (err) { console.log('OMG something went really wrong: ' + err); }); | |
var irc = require('irc'); | |
//https://github.com/martynsmith/node-irc | |
//npm install irc | |
var MYBOT = {}; | |
MYBOT.channelname = "#node.js"; | |
MYBOT.nick = "ryan_opper"; |
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 common = require('../common'); | |
var connection = common.createConnection(); | |
var assert = require('assert'); | |
common.useTestDb(connection); | |
var table = 'insert_test'; | |
connection.query([ | |
'CREATE TEMPORARY TABLE `' + table + '` (', | |
'`title` varchar(255),', |
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
upstream node_js { | |
server 127.0.0.1:8000; | |
} | |
server { | |
... | |
... | |
location ~^/nodejs/ { |
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
//This allows you to specify a certificate and a key and will create a server that just handles redirects, if you want it. | |
/*Using let's encrypt to create a free certificate: | |
cd /root/ | |
git clone https://github.com/letsencrypt/letsencrypt | |
cd letsencrypt | |
./letsencrypt-auto certonly --webroot -w /my/web/root --email my@email.com -d myDomain.com | |
//add ssl:certificate location of 'fullchain.pem' and ssl:key location of 'privkey.pem' | |
*/ |
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
#install instructions at https://newrelic.com/docs/server/server-monitor-installation-ubuntu-and-debian | |
base: | |
pkgrepo.managed: | |
- humanname: Newrelic PPA | |
- name: deb http://apt.newrelic.com/debian/ newrelic non-free | |
# - dist: precise | |
- file: /etc/apt/sources.list.d/newrelic.list | |
- keyid: 548C16BF | |
- keyserver: subkeys.pgp.net |
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
//using a function-scope `data` variable to save the data | |
function getData(respondentId) { | |
var data={}; | |
return Respondent.findById(respondentId) | |
.then(respondent => { | |
data.respondent = respondent; | |
return Box.findById(respondent.box_id) | |
}) | |
.then(box => { | |
data.box = box |
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
function checkAndSetAccount(){ | |
var q = riot.route.query(); | |
if (Cookies.get('account')==q.account) return;//already done. | |
if (q.account) { | |
Cookies.set('account',q.account); | |
auth.trigger('switchAccount'); | |
} | |
if (!q.account && Cookies.get('account')!==Cookies.get('accountOriginal')) {//nothing in query string: need to set it | |
//console.log(window.location) | |
var newLocation=window.location.hash; |
OlderNewer