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
const requireHTTPS = (req, res, next) => { | |
if(req.headers['x-forwarded-proto'] !== 'https' && process.env.NODE_ENV === 'production') { | |
var secureUrl = "https://" + req.headers['host'] + req.url | |
res.writeHead(301, { "Location": secureUrl }) | |
res.end() | |
} | |
next() | |
} | |
app.use(requireHTTPS) |
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
import React from 'react'; | |
import ItemsCollection from './../collections/items'; | |
const Items = React.createClass({ | |
getInitialState() { | |
return { | |
items: [] | |
}; |
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 h = new Headers() | |
h.append('Authorization', 'Bearer xxx'); | |
h.append('Cookie', 'xxx'); | |
h.append('Content-Type', 'application/json'); | |
fetch('http://localhost:4567/api/reviews', { | |
headers: h, | |
method: 'POST', | |
body: JSON.stringify({ "foo": "bar" }) | |
}).then(function (res) { | |
return res.json().then(function (json) { |
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 $ = require('jquery'); | |
$('body').css('background-color', 'red'); |
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 _vent = require('./vent.js').shared(); | |
_vent.trigger('blah'); |
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 Backbone = require('backbone'); | |
var $ = require('jquery'); | |
var Handlebars = require('handlebars'); | |
var HandlebarsHelpers = require('base/utils/template-helpers'); | |
var templateCache = require('base/utils/template-cache'); | |
module.exports = Backbone.View.extend({ | |
initialize: function(options) { | |
this.templates = templateCache.get(); |
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 gulp = require('gulp'); | |
var source = require('vinyl-source-stream'); | |
var watchify = require('watchify'); | |
var livereload = require('gulp-livereload'); | |
var hbsfy = require("hbsfy").configure({ | |
extensions: ["html"] | |
}); | |
gulp.task('scripts', function() { |
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 $ = require('jquery'); | |
$('body').css('background-color', 'red'); |
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
Had a similar question a few weeks ago, so might as well forward you that! | |
http://addyosmani.com/resources/essentialjsdesignpatterns/book/ | |
http://shop.oreilly.com/product/0636920025245.do | |
http://shop.oreilly.com/product/0636920018421.do | |
http://shop.oreilly.com/product/9780596806767.do |
NewerOlder