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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<div> | |
<a href="#test" aria-label="Case 1" style="background-size: cover; background-image: url(https://pbs.twimg.com/profile_images/378800000532546226/dbe5f0727b69487016ffd67a6689e75a.jpeg);width: 300px; height: 240px; display:block;"> |
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 mongoose = require('mongoose'); | |
var TestSchema = new mongoose.Schema({ | |
a : Array, | |
s : String, | |
n : Number | |
}); | |
var Test = mongoose.model('Test', TestSchema); | |
mongoose.connection.once('open', 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
if (/chrome/.test(navigator.userAgent.toLowerCase())) { | |
FB.XD._origin = window.location.protocol + '//' + document.domain + '/' + FB.guid(); | |
FB.XD.Flash.init(); | |
FB.XD._transport = 'flash'; | |
} |
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
// Grid Date Header | |
joli.ui.GridDateView = Backbone.View.extend({ | |
tagName: 'li', | |
className: 'joli-grid-date', | |
template: 'joli-template-grid-date', | |
initialize: function() { | |
_.bindAll(this, 'render'); | |
this.model.bind('change', this.render); | |
}, |
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 mongoose = require('mongoose'), | |
Schema = mongoose.Schema; | |
mongoose.connect('mongodb://localhost/db'); | |
var User = new Schema({ | |
email: { 'type': String, 'required': true, 'index': { 'unique': true, 'background': true } }, | |
}); | |
User = mongoose.model('User', User); |
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 url = require('url'), | |
assert = require('assert'); | |
var test = 'http://➡.ws/pageloads'; | |
var parsed = url.parse(test); | |
assert.equal(parsed.host, '➡.ws'); | |
console.log('URL parsed correctly.'); |
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 urlToResolve = 'https://github.com/kriskowal/tigerblood/'; | |
var https = require('https'), | |
url = require('url'), | |
jsdom = require('jsdom'); | |
var parsedUrl = url.parse(urlToResolve); | |
var path = parsedUrl.pathname; | |
var options = { | |
host: parsedUrl.hostname, |
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 support_speech_attribute() { | |
var elem = document.createElement('input'); | |
return 'speech' in elem || 'onwebkitspeechchange' in elem; | |
// update based on https://github.com/Modernizr/Modernizr/wiki | |
// - 'webkitSpeech' in elem -> does`t work correctly in all versions of Chromium based | |
// browsers: can return false even if they have support for speech (http://i.imgur.com/2Y40n.png) | |
// - testing with 'onwebkitspeechchange' seems to fix this problem | |
} | |
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
// Load the http module to create an http server. | |
var http = require('http'); | |
// Configure our HTTP server to respond with Hello World to all requests. | |
var server = http.createServer(function (request, response) { | |
response.writeHead(200, {"Content-Type": "text/plain"}); | |
response.end("Hello World\n"); | |
}); | |
// Listen on port 8000, IP defaults to 127.0.0.1 |