Skip to content

Instantly share code, notes, and snippets.

/**
* Autocomplete editor that can store a value separately to its displayed
* value. Uses a "handsontable-in-handsontable" editor.
*
* Requires the following configuration:
*
* - `source`, an array of arrays or a function that takes `query` and
* `callback` parameters like the one used by `AutocompleteEditor`.
* The data passed should be an array of objects or array of arrays,
* akin to the `data` of a Handsontable instance.
SELECT `planDays`.`projectId` AS `projectId`,
`planDays`.`allocationId` AS `allocationId`,
ROUND(SUM(`planDays`.`hours` *
(SELECT `rates`.`cost`
FROM `rates`
INNER JOIN `teamMemberGrades` ON `rates`.`id` = `teamMemberGrades`.`rateId`
AND `teamMemberGrades`.`teamMemberId` = `planDays`.`teamMemberId`
WHERE `teamMemberGrades`.`startDate` IS NULL
OR `planDays`.`day` >= `teamMemberGrades`.`startDate`
ORDER BY `teamMemberGrades`.`startDate` DESC LIMIT 1)), 2) AS `value`
@optilude
optilude / registry.js
Last active December 19, 2015 10:49
Generic, asynchronous, dependency-aware, promise-based operations registry
/*jshint globalstrict:true, devel:true */
/*global require, module, exports, process, __dirname */
"use strict";
var Toposort = require('toposort-class'),
promise = require('node-promise'),
_ = require('underscore');
module.exports = (function() {
@optilude
optilude / Model definitions
Last active December 19, 2015 00:59
Test database for joins
module.exports = function(sequelize, DataTypes) {
return sequelize.define("allocation", {
// Foreign keys: project
name: {
type: DataTypes.STRING,
allowNull: false
},
code: {
type: DataTypes.STRING,
allowNull: false
@optilude
optilude / plugins.js
Last active March 27, 2017 19:58
Simple validation framework for Handsontable
define([
'jquery',
'underscore',
'app/app',
'jquery.handsontable',
'moment',
'jquery.tools'
], function($, _, app, Handsontable, moment) {
@optilude
optilude / buster.js
Last active December 12, 2015 09:28
buster.js test with debugger
var config = module.exports;
config["Client"] = {
autoRun: false,
rootPath: "../",
environment: "browser",
libs: [
'public/vendor/libs/require.js',
'public/require.config.js'
],
// Set the require.js configuration for your application.
require.config({
// Load common paths and shims and then load the main.js bootstrap script
deps: [
'require.config',
'app/main'
]
});
@optilude
optilude / gist:4415546
Created December 30, 2012 22:13
Error running any easy_install or setup.py install on my ReadyNas Duo with the Python 2.7 package
nas:~# easy_install -U flickrbackup
Searching for flickrbackup
Reading http://pypi.python.org/simple/flickrbackup/
Reading http://github.com/optilude/flickrbackup
Best match: flickrbackup 0.2
Downloading http://pypi.python.org/packages/source/f/flickrbackup/flickrbackup-0.2.tar.gz#md5=f39fc9dfe59118faeb3d28198b5c282d
Processing flickrbackup-0.2.tar.gz
Writing /tmp/easy_install-bJ7azw/flickrbackup-0.2/setup.cfg
Running flickrbackup-0.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-bJ7azw/flickrbackup-0.2/egg-dist-tmp-pf04QD
warning: install_lib: 'build/lib.linux-padre-2.7' does not exist -- no Python modules to install
@optilude
optilude / gist:3885011
Created October 13, 2012 15:32
Draft test cases for plone.app.theming
# Theme control panel
Scenario: Preview theme
Given a logged-in admin user
And a Plone site with no theme applied
When I navigate to the "Theming" control panel
And I click on the "Example theme" theme preview
Then a preview of "Example theme" is shown in a new window
Scenario: Activate theme
γ bin/instance fg
2012-09-22 23:26:07 INFO ZServer HTTP server started at Sat Sep 22 23:26:07 2012
Hostname: 0.0.0.0
Port: 8080
2012-09-22 23:26:09 WARNING SecurityInfo Conflicting security declarations for "setText"
2012-09-22 23:26:09 WARNING SecurityInfo Class "ATTopic" had conflicting security declarations
2012-09-22 23:26:11 WARNING ZODB.blob (3789) Blob dir /Users/optilude/Development/Plone/buildout.deco/var/blobstorage/ has insecure mode setting
2012-09-22 23:26:15 WARNING collective.quickupload.interfaces Importing interfaces from collective.quickupload.browser.interfaces is deprecated, please import from collective.quickupload.interfaces
Traceback (most recent call last):
File "/Users/optilude/.buildout/eggs/Zope2-2.13.16-py2.7.egg/Zope2/Startup/run.py", line 76, in <module>