Skip to content

Instantly share code, notes, and snippets.

View tarlepp's full-sized avatar
💭
örrr

Tarmo Leppänen tarlepp

💭
örrr
  • Pinja
  • Jyväskylä, Finland
View GitHub Profile
body.on('taskAdd', function(event, story) {
jQuery.get('/Task/add', {projectId: story.projectId(), storyId: story.id()}, function(content) {
var title = "Add new task to story '" + ko.toJS(story.title()) + "'";
var buttons = [
{
label: "Save",
class: "btn-primary pull-right",
callback: function () {
var form = jQuery('#formTaskNew');
var formItems = form.serializeJSON();
@tarlepp
tarlepp / gist:6120180
Created July 31, 2013 08:00
Quick fix for bootboxjs to work with bootstrap 3.0.0, basically just added parts.push("<div class='modal-dialog'>"); parts.push("<div class='modal-content'>"); and parts.push("</div>"); parts.push("</div>");
var parts = ["<div class='bootbox modal' tabindex='-1' style='overflow:hidden;'>"];
parts.push("<div class='modal-dialog'>");
parts.push("<div class='modal-content'>");
if (options['header']) {
var closeButton = '';
if (typeof options['headerCloseButton'] == 'undefined' || options['headerCloseButton']) {
closeButton = "<a href='"+_defaultHref+"' class='close'>&times;</a>";
}
// Open bootbox modal
var modal = openBootboxDialog(title, content, buttons, false);
modal.on('hidden.bs.modal', function() {
console.log('hidden');
});
modal.on('show.bs.modal', function() {
console.log('show');
});
/**
* Local environment settings
*
* While you're developing your app, this config file should include
* any settings specifically for your development computer (db passwords, etc.)
* When you're ready to deploy your app in production, you can use this file
* for configuration options on the server where it will be deployed.
*
*
* PLEASE NOTE:
@tarlepp
tarlepp / gist:8984046
Last active August 29, 2015 13:56 — forked from jdcauley/gist:8984009
module.exports = {
index: function (req,res) {
File.find().exec(function(err, files) {
res.view({
files: files,
user: req.user
});
});
},
Object {status: 500, errors: Array[1]}
errors: Array[1]
0: Object
ValidationError: Object
title: Array[1]
0: Object
args: Array[1]
data: "6"
message: "Validation error: "6" Rule "minLength(5)" failed."
rule: "minLength"
var travelBookingApplication = angular.module("travelBookingApplication", [
"ngRoute",
"angularSails.io",
"travelBookingControllers",
"travelBookingServices"
]);
travelBookingApplication.factory("sailsSocket", function(sailsSocketFactory) {
return sailsSocketFactory();
});
wunder@wunder-VirtualBox:~/projects$ node Taskboard/app.js
warn: Session secret must be identified!
Should be of the form: `config.session = { secret: "someVerySecureString" }`
Automatically generating one for now...
(Note: This will change each time the server starts and break multi-instance deployments.)
e.g. To set up a session secret, add or update it in `config/session.js`:
module.exports.session = { secret: "keyboardcat" }
info:
info:
info: Sails.js <|
// Sort stories by tasks progress
data.stories.data.sort(dynamicSortMultiple("!tasks.progress", "title", "priority"));
function dynamicSort(property) {
return function(obj1, obj2) {
var reverse = (property.indexOf("!") === 0);
if (reverse) {
property.substr(1);
}
// Sort stories by tasks progress, story title and priority
data.stories.data.sort(dynamicSortMultiple("!tasks.progress", "title", "priority"));
function dynamicSort(property) {
return function(obj1, obj2) {
var reverse = (property.indexOf("!") === 0);
var comparisonValue1, comparisonValue2 = '';
if (reverse) {
property = property.substr(1);