Skip to content

Instantly share code, notes, and snippets.

Eric Blade ericblade

Block or report user

Report or block ericblade

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ericblade / gist:2cc866f32a17f7c9076713a4ace2fb4a
Created Sep 18, 2018
node.js 6+ function for erroring when accessing an undefined property on an object, useful for application constant includes and such
View gist:2cc866f32a17f7c9076713a4ace2fb4a
function disallowUndefinedAccess(obj) {
const handler = {
get(target, property) {
if (property in target) {
return target[property];
throw new ReferenceError(`Access unknown ${property.toString()}`);
View multiApiCall.js
/* An incredibly handy function to run several (probably related) Promises simultaneously,
* allowing for any given Promise to reject, results will be returned in an object with same key names as the input
/* example:
* const x = {
* api1: () => callApi1(),
* api2: () => callApi2(),
* api3: () => callApi3(),
* };
ericblade / app.js
Created Sep 10, 2012
LINE 非公式 API を使ってログイン
View app.js
var LINE = require('./line.js');
var line = new LINE();
var email = 'your email';
var password = 'your password';
line.login(email, password, function(error, result) {
if (error) {
ericblade / EnyoPlatform.js
Created Feb 19, 2012
Enyo kind for handling platform specific info
View EnyoPlatform.js
/* Enyo Platform encapsulation. Include this FIRST in your depends.js. The
* first call you make to a function inside it will cause it to perform it's
* detection (in the setup function). If you are running in PhoneGap, and your
* app depends on accurate results in here, make sure that you are not running
* any code that depends on this module until after the "deviceready" PhoneGap
* event is fired.
* This prefers direct access to APIs whenever possible - although you CAN run
* webOS and WebWorks apps with PhoneGap, I'm trying to avoid going through any
* extra layers here.
View gist:1175841
this.log("Inbox Received");
i = inResponse.indexOf("<json><!")+14;
j = inResponse.lastIndexOf("></json>")-1;
inboxJSON = JSON.parse(inResponse.substring(i,j));
View gist:1175795
"displayNumber":"(734) 123-9456",
"displayStartDateTime":"8/27/11 3:14 PM",
"displayStartTime":"3:14 PM",
"relativeStartTime":"23 minutes ago",
You can’t perform that action at this time.