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
import ( | |
"runtime" | |
"time" | |
) | |
... | |
go func() { | |
for { | |
var m runtime.MemStats |
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
//issue a token, with an expiration date | |
var jwt = require('jsonwebtoken') | |
//issue token that expires after 10 mins AND has an issuer | |
var token = jwt.sign('helloworld','secret',{ expiresInMinutes : 10, issuer : 'hipster.io'}); | |
//verify token, but don't check assertions. |
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
authenticate : function(req,res){ | |
var username = req.param('username') | |
var password = req.param('password') | |
if(!username || !password){ | |
return res.json(403,{err : 'username and password required'}) | |
} | |
User.findOneByUsername(username,function(err,user){ |
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
/** | |
* sails-jwt-auth configuration and devdocs | |
* | |
* | |
*/ | |
/** |
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
// Copyright (c) 2012 Sutoiku, Inc. (MIT License) | |
function HEX2BIN(number, places) { | |
// Return error if number is not hexadecimal or contains more than ten characters (10 digits) | |
if (!/^[0-9A-Fa-f]{1,10}$/.test(number)) return '#NUM!'; | |
// Check if number is negative | |
var negative = (number.length === 10 && number.substring(0, 1).toLowerCase() === 'f') ? true : false; | |
// Convert hexadecimal number to decimal |
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 PORT = 10443; | |
var SSL_KEY = '___.key'; | |
var SSL_CERT= '___.cert'; | |
var fs = require('fs'); | |
var io = require('socket.io').listen(PORT, { | |
key : fs.readFileSync(SSL_KEY).toString(), | |
cert : fs.readFileSync(SSL_CERT).toString() | |
}); |
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 app = require('express').createServer() | |
var io = require('socket.io').listen(app); | |
var fs = require('fs'); | |
app.listen(8008); | |
// routing | |
app.get('/', function (req, res) { | |
res.sendfile(__dirname + '/chat.html'); | |
}); |
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
<script> | |
// (c) Copyright 2011 Caroline Schnapp. All Rights Reserved. Contact: [email protected] | |
// See http://wiki.shopify.com/Linked_Options | |
var Shopify = Shopify || {}; | |
Shopify.optionsMap = {}; | |
Shopify.updateOptionsInSelector = function(selectorIndex) { | |
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
<?php | |
require 'google-api/apiClient.php'; | |
require 'google-api/contrib/apiOauth2Service.php'; | |
require 'google-api/contrib/apiDriveService.php'; | |
$pdfFile = 'test.pdf'; | |
// API Console: https://code.google.com/apis/console/ | |
// Create an API project ("web applications") and put the client id and client secret in config.ini. |