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
# Checks to see if the release you're deploying and the last version's "assets" directories have | |
# the same lines (content). If they do, don't run the asset precompilation. | |
# | |
# Notes on this at the delicious stackoverflow.com: | |
# http://stackoverflow.com/questions/9016002/speed-up-assetsprecompile-with-rails-3-1-3-2-capistrano-deployment | |
# | |
# @note This fucks things up when you add stuff to the precompile list. It won't precompile | |
# those new items 'cause it doesn't think there is anything new. A little bit manual but is a | |
# gotcha so would be nice to handle with this as well. | |
# |
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 express = require('express'); | |
var app = express(); | |
app.get('*', function(req, res) { | |
var staticTopLevelFolders = [ | |
'assets', | |
'app' | |
] | |
var requestedTopLevelFolder = (req._parsedUrl.pathname).split('/')[1]; |
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
search: function (options) { | |
var result = this.where(options); | |
var resultCollection = new window["**need this's class name here**"](result); | |
return resultCollection; | |
} |
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 getValidators = function(model, attr) { | |
var attrValidationSet = model.validation ? model.validation[attr] || {} : {}; | |
// If the validator is a function or a string, wrap it in a function validator | |
if (_.isFunction(attrValidationSet) || _.isString(attrValidationSet)) { | |
attrValidationSet = { | |
fn: attrValidationSet | |
}; | |
} | |
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
// pass in the $parentEl in the options so you can reference it. | |
render: function () { | |
this.$el = $(this.template({ | |
... | |
})).appendTo(this.$parentEl); | |
// Call delegateEvents() afterwards if you have events in your view you want bound to the new this.$el | |
this.delegateEvents(); | |
} |
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
// Allows you to create a child which is a copy of the parent and changing the child or parent doesn't affect one another. | |
// Calling "this" inside the child won't change attributes of the parent, as it is a copy and not connected through the prototype chain. | |
define(['jquery', 'underscore', 'backbone'], function ($, _, Backbone) { | |
// NOTE: This works in every scenario I've tested it in. However, this code looks bad | |
// and there may very well be a much cleaner + better way to handle this. Or maybe not | |
// because JS prototypes are crazy. | |
function childOfClass (parentFunction, newAttributes) { |
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 options = new Array(); | |
$('select[name=select_name] > option').each(function (i) { | |
options[i] = $(this).text(); | |
}); | |
var string = ""; | |
for (var i=0; i<options.length; i++) { | |
string += "\"" + options[i] + "\"" + ","; | |
if (i + 1 != options.length) { | |
string += "\n"; | |
} |
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
.arrow { | |
position: absolute; | |
top: 15px; | |
left: -11px; | |
z-index: 100; | |
.back { | |
position: absolute; | |
top: 0; | |
left: 0; |
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
sudo kill `ps -ax | grep 'coreaudiod' | grep 'sbin' |awk '{print $1}'` |
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
<div id="commentable-area"> | |
<p data-section-id="1" class="commentable-section"> | |
This is a section that can be commented on. | |
</p> | |
<p data-section-id="2" class="commentable-section"> | |
This is a another section that can be commented on. | |
</p> | |
<p data-section-id="3" class="commentable-section"> | |
This is yet another section that can be commented on. | |
</p> |
OlderNewer