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
'use strict'; | |
module.exports = function CustomError(message, extra) { | |
Error.captureStackTrace(this, this.constructor); | |
this.name = this.constructor.name; | |
this.message = message; | |
this.extra = extra; | |
}; | |
CustomError.prototype = Object.create(Error.prototype); |
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
/* | |
* media.matchMedium()- test whether a CSS media type or media query applies | |
* primary author: Scott Jehl | |
* Copyright (c) 2010 Filament Group, Inc | |
* MIT license | |
* adapted by Paul Irish to use the matchMedium API | |
* http://www.w3.org/TR/cssom-view/#media | |
* Doesn't implement media.type as there's no way for crossbrowser property | |
* getters. instead of media.type == 'tv' just use media.matchMedium('tv') |
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 throttle(millis, fn) { | |
var sched; | |
return function() { | |
if (!sched) | |
sched = setTimeout(function executeAndClear() { fn(); sched = false; }, millis); | |
}; | |
} |
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
app.get('/robots.txt', function(req, res){ | |
var rules = [ | |
'User-agent: *', | |
'Disallow: /' | |
].join('\n'); | |
res.send(rules, { 'Content-Type': 'text/plain' }, 200); | |
}); |
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>Opentype Test</title> | |
<style> | |
span.opentype-test { | |
font-family: Corbel; | |
font-size: 100px; | |
position: absolute; |
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
<!-- Mocha test output goes here. --> | |
<div id="mocha"></div> | |
<!-- Handlebars templates for our application. --> | |
<script type="text/x-handlebars"> | |
<h1>Testing Ember.js with Mocha</h1> | |
{{outlet}} | |
</script> | |
<script type="text/x-handlebars" data-template-name="index"> |
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
Ember.Model.reopenClass | |
adapter: MyApp.RESTAdapter.create() | |
camelizeKeys: true | |
rootKey: (-> | |
@toString().split('.').get('lastObject').underscore() | |
).property() | |
collectionKey: (-> | |
Em.get(@, 'rootKey') + 's' |
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
// app/locations/history.js | |
export default Ember.HistoryLocation.extend({ | |
pushState() { | |
this._super(...arguments); | |
window.scrollTo(0, 0); | |
} | |
}); | |
``` |
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
#!/bin/bash | |
echo "Generating an SSL private key to sign your certificate..." | |
openssl genrsa -des3 -out default.key 1024 | |
echo "Generating a Certificate Signing Request..." | |
openssl req -new -key default.key -out default.csr | |
echo "Removing passphrase from key (for nginx)..." | |
cp default.key default.key.org | |
openssl rsa -in default.key.org -out default.key |
OlderNewer