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
var HID = require('HID'), | |
path; | |
HID.devices().forEach( function(device) { | |
if ( device.product.match(/Dream Cheeky/) ) { | |
console.log(device); | |
path = device.path; | |
} | |
}); | |
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
YUI.add('paged-model-list', function(Y) { | |
var NS = Y.namespace('BackOffice.Model'), | |
Lang = Y.Lang, | |
isString = Lang.isString, | |
isArray = Lang.isArray, | |
isObject = Lang.isObject; | |
function PagedList() { } | |
PagedList.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
/* Render the login action */ | |
app.get('/login', function(req, res) { | |
res.render('login') | |
}); | |
/* Handle posting, if it fails this redirects back to /login, following POST-Redirect-GET */ | |
app.post('/login', | |
requireAuth(Y), | |
function(req, res) { | |
/** |
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
YUI.add('handlebars-helpers', function(Y) { | |
var NS = Y.namespace('TDP'), | |
Handlebars = Y.Handlebars, | |
Lang = Y.Lang, | |
isString = Lang.isString, | |
isArray = Lang.isArray, | |
isObject = Lang.isObject, | |
isFunction = Lang.isFunction, | |
Aeach = Y.Array.each, |
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
/* | |
*/ | |
var template = Y.Handlebars.compile('{{{ render_form form }}}'), | |
goal = this.get('model'), | |
output = template( | |
{ | |
form : { | |
/** | |
Values is a short-hand, it just sets values for each of the elements below correctly. |
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
new Queue('build TDP') | |
.task('files', file_list) | |
//.task('jslint') | |
.task('concat') | |
// With the replace line in, I get no output at all. It just silently fails. | |
.task('replace', { regex: "^.*?(?:logger|Y.log).*?(?:;|\\).*;|(?:\r?\n.*?)*?\\).*;).*;?.*?\r?\n", replace: '', flags: 'mg' }) | |
.task('jsminify') | |
//.task('inspect') | |
.task('write', { name: './tdp-bundle-min.js' }) | |
.run(); |
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
FancyApp = Y.Base.create('fancyApp', Y.App, [ Y.App.ResponsiveViews, Y.App.Transitions ], { | |
views : { | |
GoalListView : { | |
type : NS.GoalListView, | |
responsive: [ | |
{ view : 'GoalListPhoneView', condition: function() { /* Determine dynamically */ } }, | |
{ view : 'GoalListPhoneView', 'maxWidth' : '480px' }, | |
{ view : 'GoalListFullView', 'minWidth' : '481px' } | |
} | |
}, |
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
/* | |
This is the Node.js file, it will export files directly to | |
`tdp-bundle-min.js` which obviously won't work well for you! | |
This relies on having a YUI_config that can be parsed and | |
passed into Y.Loader. Everything you need should be in this | |
gist, though. You may need to change the path to your | |
YUI_config file (mine is named `bundle.js`). | |
However, it's an easy change, just scroll down and edit it. |
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
YUI.add('tdp-autoview', function(Y) { | |
var NS = Y.namespace('TDP'), | |
View = Y.Base.create('tdpAutoView', Y.View, [], { | |
render : function() { | |
this.findViews(); | |
return this; | |
}, |
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
// When you define your module, you specify a function to run when it's being added in. | |
// This includes a `Y` object: | |
YUI.add('myModule', function(Y) { | |
Y.Foo = function() { alert("Foo"); }; | |
}); | |
// When you *use* your module, you declare a similar function that gets a `Y` object passed in. | |
YUI().use('myModule', function(Y) { | |
Y.Foo = function() { alert("Bar"); }; | |
}); |