Skip to content

Instantly share code, notes, and snippets.

View tauren's full-sized avatar

Tauren Mills tauren

View GitHub Profile
@tauren
tauren / application.js
Created May 17, 2013 06:15
Sails with middleware
module.exports = {
// Name of the application (used as default <title>)
appName: "Sails Application",
// Port this Sails application will live on
port: 1337,
// The environment the app is deployed in
@tauren
tauren / data.js
Created January 29, 2013 07:50
AMD module that extracts data attributes from script tag that contains data-main attribute and returns an object containing all of the data values.
/*
* @description Extracts data attributes from script tag that contains data-main attribute
* and returns an object containing all of the data values.
* @author Tauren Mills (github.com/tauren)
*/
define(function() {
// Get all of the script tags
var scripts = document.getElementsByTagName('script');
var data = {};
2012-10-05 02:40:24.209:INFO:oejs.Server:jetty-8.1.5.v20120716
2012-10-05 02:40:27.457:INFO:oejpw.PlusConfiguration:No Transaction manager found - if your webapp requires one, please configure one.
2012-10-05 02:41:41.180:WARN:oejx.XmlConfiguration:Config error at <Set name="sessionPath">/</Set> java.lang.NoSuchMethodException: class org.eclipse.jetty.server.session.HashSessionManager.setSessionPath(class java.lang.String)
2012-10-05 02:41:41.180:WARN:oejx.XmlConfiguration:Config error at <Get name="sessionManager"><Set name="sessionCookie">MYJETTYSESSION</Set><Set name="sessionPath">/</Set><Set name="secureCookies">true</Set><Set name="httpOnly">true</Set></Get> java.lang.NoSuchMethodException: class org.eclipse.jetty.server.session.HashSessionManager.setSessionPath(class java.lang.String)
2012-10-05 02:41:41.180:WARN:oejx.XmlConfiguration:Config error at <Get name="sessionHandler"><Get name="sessionManager"><Set name="sessionCookie">MYJETTYSESSION</Set><Set name="sessionPath">/</Set><Set
<script>
// Load browser shims
Modernizr.load([
{
test: window.JSON,
nope: 'libs/shims/json3.js'
},
{
test: Object.getOwnPropertyNames,
nope: "libs/shims/es5-shim.js",
// Bind all of an object's methods to a specific context. Useful for ensuring that
// all callbacks defined on an object belong to it.
var context = function(obj, ctx) {
var funcs = Array.prototype.slice.call(arguments, 2);
if (funcs.length == 0) funcs = _.functions(obj);
_.each(funcs, function(f) { obj[f] = _.bind(obj[f], ctx); });
return obj;
};
var html = $('script#todo').html();
var data = {
content: 'Todo item',
done: false
};
var map = Plates.Map();
map.class('todo-content').to('content');
renderTemplate: function(model, extras) {
var json = {
'orders': [
{'id':'o12345','status':'Shipped','ordered':'2011-06-01'},
{'id':'o34567','status':'Pending','ordered':'2011-07-01'},
{'id':'o56789','status':'Shipped','ordered':'2011-08-01'}
]
};
var tmpl = 'script#ordersTmpl';
var html = Plates.bind($(tmpl).html(), json);
@tauren
tauren / footer.php
Created January 1, 2012 22:45
Sample wordpress template files
Integer filled = new Integer(value);
if (filled != null) {
switch (filled) {
case 4: // Unassigned games - Games with no assignments filled
// Pseudocode: select games where count(assignments with status = ACCEPTED) = 0 and count(positions) > 0
search.addFilterNone("assignments", Filter.equal("statusCode",AssignmentStatus.ACCEPTED.getCode()));
search.addFilterGreaterThan("schedule.positions.size", 0);
break;
case 3: // Partially assigned games - Games with some assignments filled
// Pseudocode: select games where count(assignments with status = ACCEPTED) < count(positions)
creampie:github tauren$ npm list -g
/usr/local/lib
├── coffee-script@1.1.2
├─┬ html2jade@0.0.6
│ ├─┬ jsdom@0.2.3
│ │ ├── contextify@0.0.3
│ │ ├── cssom@0.2.0
│ │ ├── htmlparser@1.7.3
│ │ └── request@2.0.2