Skip to content

Instantly share code, notes, and snippets.

View vernondegoede's full-sized avatar
:shipit:

Vernon de Goede vernondegoede

:shipit:
View GitHub Profile
@vernondegoede
vernondegoede / gist:8dab074d09ef4dc68e41
Created May 20, 2015 09:22
Serialize multidimensional form into a JavaScript object
$.fn.serializeObject = function () {
var o = {};
var serialized = {};
$("[name]", this).each(function () {
var name = $(this).attr('name');
var value = $(this).val();
var nameBits = name.split('[');
var previousRef = serialized;
for (var i = 0, l = nameBits.length; i < l; i++) {
@vernondegoede
vernondegoede / gist:ea113fba8f7d239f2f03
Created June 10, 2015 13:21
Fix sshkit / colorize bug in Capistrano
Modify your Gemfile.lock, set the following Gems to corresponding versions:
colorize 0.7.4
sshkit 1.5.1
@vernondegoede
vernondegoede / gist:80b4b0eb4e634817f85e
Last active August 29, 2015 14:23
being_indexed() by Prerender
function being_indexed() {
var userAgent = navigator.userAgent,
isPresent = userAgent.search('Prerender');
return isPresent !== -1;
}
@vernondegoede
vernondegoede / controller
Last active February 29, 2016 13:20
Rubymine Live Templates for Backbone.js & Marionette.js
App.module("App.$PARAM$", function ($PARAM$, App, Backbone, Marionette, $, _) {
'use_strict';
$PARAM$.Controller = {
showHomepage: function () {
this.entities = this.getEntities();
this.instantiateViews();
this.setViewHandlers();
@vernondegoede
vernondegoede / ga_onerror.js
Created May 21, 2016 15:17
Send errors to Google Analytics
// Send errors to Google Analytics
window.onerror = (msg, file, line, column, error=null) => {
try {
if (error) msg = error.stack;
ga('send', 'event', 'error', '${file}:${line}', msg);
} catch (e) {
// Do nothing
}
}
@vernondegoede
vernondegoede / single_view.js
Last active May 21, 2016 15:17
TemplateHelper in CompositeView
Single.ProductItemView = Marionette.CompositeView.extend({
templateHelpers: function () {
return {
image: function () {
var image = this.model.getPreviewImage();
if (image) {
return image.get('large_url');
}
return "";
}
@vernondegoede
vernondegoede / npm-cheat-sheet.md
Created June 26, 2016 10:27 — forked from AvnerCohen/npm-cheat-sheet.md
Node.js - npm Cheat Sheet

Node.js - npm Cheat Sheet

(Full description and list of commands at - https://npmjs.org/doc/index.html)

##List of less common (however useful) NPM commands

######Prepand ./bin to your $PATH Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:

➜ Doka git:(master) ✗ phonegap plugin add --save https://github.com/CreativeSDK/phonegap-plugin-csdk-image-editor
Fetching plugin "https://github.com/CreativeSDK/phonegap-plugin-csdk-image-editor" via git clone
Repository "https://github.com/CreativeSDK/phonegap-plugin-csdk-image-editor" checked out to git ref "master".
Installing "phonegap-plugin-csdk-image-editor" for browser
Fetching plugin "https://github.com/CreativeSDK/phonegap-plugin-csdk-client-auth" via git clone
Repository "https://github.com/CreativeSDK/phonegap-plugin-csdk-client-auth" checked out to git ref "master".
@vernondegoede
vernondegoede / webpack.config.js
Created August 9, 2016 20:38
webpack.config.js
const webpack = require('webpack');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const path = require('path');
module.exports = {
entry: './src/initialize.js',
assetsPublicPath: '',
output: {
path: __dirname + '/www/',
filename: 'bundle.js'
fetchActivityFeedForRanking (options) {
let collection = options.views.feedItemsView.collection;
let data = {};
let { ranking_id } = this;
if (ranking_id) {
data = {
ranking_id
};
}