Skip to content

Instantly share code, notes, and snippets.

@jeremys
jeremys / index.html
Last active August 29, 2015 14:21
Voiceover does not parse the following code properly
<!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;">
@jeremys
jeremys / bug.js
Created March 2, 2012 18:01 — forked from jerem/bug.js
Mongoose array bug
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() {
if (/chrome/.test(navigator.userAgent.toLowerCase())) {
FB.XD._origin = window.location.protocol + '//' + document.domain + '/' + FB.guid();
FB.XD.Flash.init();
FB.XD._transport = 'flash';
}
@jeremys
jeremys / dateheader.js
Created July 8, 2011 16:54
Date Header
// 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);
},
@jeremys
jeremys / conflict.js
Created June 22, 2011 16:19
Index/Save conflict
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);
@jeremys
jeremys / unicodeurlparse.js
Created June 3, 2011 16:58
Unicode URL parsing in Node
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.');
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,
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
}
// 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