Skip to content

Instantly share code, notes, and snippets.

Avatar

Jordan Hawker elwayman02

View GitHub Profile
View gist:6d304d424cda273d345a
onWaitListUpdate: function() {
// If autojoin is not enabled, don't try to disable
if (!Settings.autojoin) return;
// If user is DJing, don't try to disable
var dj = API.getDJ();
if (dj !== null && dj.id === API.getUser().id) return;
// If user is in waitlist, don't try to disable
if (API.getWaitListPosition() > -1) return;
// If waitlist is full, don't try to disable
if (API.getWaitList().length == 50) return;
View plugCubed
/**
* @license Copyright © 2012-2015 The plug³ Team and other contributors
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
View plugCubed
/**
* @license Copyright © 2012-2015 The plug³ Team and other contributors
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
View gist:d3ec3381a3a93d544378
$ npm install
> jordan-hawker@0.0.3 postinstall c:\Projects\GitHub\jordan-hawker
> bower install
npm WARN unmet dependency c:\Projects\GitHub\jordan-hawker\node_modules\ember-cl
i\node_modules\broccoli-sane-watcher requires sane@'1.0.0-rc1' but will load
npm WARN unmet dependency c:\Projects\GitHub\jordan-hawker\node_modules\ember-cl
i\node_modules\sane,
npm WARN unmet dependency which is version 0.8.0
View Raffle Code
function getWinPosition(joins, winner) {
var spots = joins.length;
var winningSpot;
var lockDistance = Math.floor(spots / 4);
if (lockDistance < 1) { lockDistance = 1;}
for (winningSpot = 0; winningSpot < lockDistance; winningSpot++) {
if (!joins[winningSpot]) {
break;
}
View style.md

This section explains the basic styles and patterns used in our JavaScript code. It borrows heavily from established resources at other companies that have extensive experience with JS, such as Yahoo, Google, and Mozilla. This guide is written with ES6 syntax in mind.

Some interesting JavaScript tips and gotchas can be found here

Comments

Use JS Doc-style comments whenever possible. Google's style guide has a great summary of JSDoc guidelines.

Strings

View components.tharp-component.js
export default Ember.Component.extend({
classNames: ['tharp-component'],
firstName: 'Daniel',
lastName: 'Tharp'
});
@elwayman02
elwayman02 / gist:1ac2cabeb1dd722a2ffa
Created Jul 14, 2015
Class definition separation
View gist:1ac2cabeb1dd722a2ffa
// foo-component.js
export default Ember.Component.extend({
classNames: ['foo'],
barClasses: Ember.computed('bar', function () {
return this.get('bar') ? 'foo bar' : 'foo';
}),
bazClasses: Ember.computed('baz', function () {
return this.get('baz') ? 'baz' : '';
View Converting libraries to Ember CLI addons.md

Converting libraries to Ember CLI addons

In this guide we will cover two main cases:

  • Ember specific library
  • vendor library

Ember library

The Ember library will assume that Ember has already ben loaded (higher in the loading order) and thus will assume it has access to the Ember API.

View keybase.md

I hereby claim:

  • I am elwayman02 on github.
  • I am jordanhawker (https://keybase.io/jordanhawker) on keybase.
  • I have a public key whose fingerprint is C0F5 0250 2F28 2134 760F 65E0 F6E1 84C8 C881 65AC

To claim this, I am signing this object:

{
You can’t perform that action at this time.