Skip to content

Instantly share code, notes, and snippets.

if ( document.getElementById('hot-network-questions') !== null ){
var buzzfeed = document.getElementById('hot-network-questions');
buzzfeed.remove();
}
{
"name": "my-stormpath-project",
"version": "1.0.0",
"dependencies": {
"basic-auth": "^1.0.0",
"bluebird": "^2.9.24",
"config": "^1.13.0",
"discourse-sso": "^1.0.2",
"express": "^4.12.3",
"express-stormpath": "^1.0.4",
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
express: {
dev: {
options: {
script: 'app.js'
var config = require('config'),
express = require('express'),
stormpath = require('express-stormpath');
var app = express();
var httpAuth = require('./middlewares/basic-auth');
app.all('/*', httpAuth('a-username', 'a-password'), function(req, res, next) {
res.locals.user = req.user;
@chrisbodhi
chrisbodhi / basic-auth.js
Created May 7, 2015 16:20
Basic Auth Middleware
var auth = require('basic-auth');
/**
* Simple basic auth middleware for use with Express 4.x.
* via http://www.danielstjules.com/2014/08/03/basic-auth-with-express-4/
*
* @param {string} username Expected username
* @param {string} password Expected password
* @returns {function} Express 4 middleware requiring the given credentials
*/
var Card = React.createClass({
componentDidMount: function() {
$(document).foundation();
},
render: function() {
var cx = React.addons.classSet;
var titleClasses = cx({
'project-title': true,
'medium-centered': true,
'small-centered': true,
var Deck = React.createClass({
render: function() {
var cardList = this.props.data.map(function (card) {
return (
<Card data={card} />
);
});
return (
<div className="deck">
{cardList}
var Dealer = React.createClass({
loadCardInfoFromServer: function() {
$.ajax({
url: this.props.url,
dataType: 'json',
success: function(data) {
this.setState({data: data});
}.bind(this),
error: function(xhr, status, err) {
console.error(this.props.url, status, err.toString());
label count
Monday 379130
Tuesday 424923
Wednesday 430728
Thursday 432138
Friday 428295
Saturday 368239
Sunday 282701
require 'minitest/autorun'
class RobotTest < MiniTest::Unit::TestCase
def test_name_sticks
robot = Robot.new
robot.name
assert_equal robot.name, robot.name
end
end