Skip to content

Instantly share code, notes, and snippets.

View jordaaash's full-sized avatar
🌴
Not on vacation, I just love palm trees

Jordan jordaaash

🌴
Not on vacation, I just love palm trees
View GitHub Profile
'use strict';
var subclass = require('../util/subclass'),
Policy = require('./policy'),
Client = require('../models/client'),
Stylist = require('../models/stylist'),
AppointmentPolicy = subclass(Policy);
AppointmentPolicy.can('request', function (user, model) {
return user instanceof Client;
'use strict';
var classes = require('./classes'),
ClassName;
ClassName = function (className) {
return {
getClassName: function () {
return classes(className, this.props.className);
}
'use strict';
var slice = Array.prototype.slice,
classes;
classes = function () {
return slice.call(arguments).filter(function (argument) {
return argument != null && argument !== '';
}).join(' ');
};
'use strict';
var slice = Array.prototype.slice,
copyProperty;
copyProperty = function () {
var properties = slice.call(arguments),
to = properties.pop(),
from = properties.pop(),
i, length, property, descriptor;
@jordaaash
jordaaash / keybase.md
Created December 4, 2014 21:39
keybase.io proof

Keybase proof

I hereby claim:

  • I am jordansexton on github.
  • I am jordansexton (https://keybase.io/jordansexton) on keybase.
  • I have a public key whose fingerprint is 215A AC3F 664E AC64 8152 822F D212 FE6C 19A5 6E81

To claim this, I am signing this object:

'use strict';
class CustomError extends Error {
constructor () {
super();
var error = Error.apply(null, arguments);
Object.getOwnPropertyNames(error).forEach((function(property) {
Object.defineProperty(this, property, Object.getOwnPropertyDescriptor(error, property));
}).bind(this));
this.name = this.constructor.name;
@jordaaash
jordaaash / webpack.js
Created April 8, 2015 13:30
2hot2handle
config.devServer = {
contentBase: config.output.path,
filename: 'assets/scripts/application.js',
host: process.env.HOST,
hot: true,
inline: true,
port: process.env.HOT_PORT,
progress: true,
publicPath: config.output.publicPath,
stats: { colors: true },
{
"name": "font-awesome",
"css_prefix_text": "icon-",
"css_use_suffix": false,
"hinting": true,
"units_per_em": 1000,
"ascent": 850,
"glyphs": [
{
"uid": "9dd9e835aebe1060ba7190ad2b2ed951",
@jordaaash
jordaaash / evil_eval.js
Last active August 29, 2015 14:19
Some crazy behavior discovered while playing around with "sandboxing" some indirectly eval'd code by shadowing in-scope variables. The first function works as expected (this and global have been shadowed in our indirect lexical scope). But if we run another call inside it without the same shadow, it doesn't inherit the indirect lexical scope, bu…
// The outer function can't access shadowed variables from the original scope ...
> (new Function('global', "'use strict'; return [typeof this, typeof global];"))();
[ 'undefined', 'undefined' ]
// ... but an inner function can (!)
> (new Function('global', "'use strict'; return (new Function(\"'use strict'; return [typeof this, typeof global];\"))();"))();
[ 'undefined', 'object ']
// It can read them.
> var foo = 'foo';
'use strict';
var path = require('path');
var Class;
try {
Class = (new Function("'use strict'; return class Class {};"))();
}
catch (error) {}