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
#! /bin/sh | |
# Set up a default search path | |
PATH="/usr/bin:/bin" | |
CURL=`which curl` | |
if [ -z "$CURL" ]; then | |
echo "curl not found" | |
exit 1 | |
fi |
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
#!/bin/bash | |
INSTALL_ROOT="/opt" | |
echo "Installing ElasticSearch..." | |
cd $INSTALL_ROOT | |
curl -L http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.1.tar.gz | tar -xz | |
ln -s elasticsearch-0.20.1/ elasticsearch | |
echo "Installing ElasticSearch service wrapper..." |
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
#!/bin/bash | |
MONGODB_REPO="/etc/yum.repos.d/10gen-mongodb.repo" | |
if [ -f ${MONGODB_REPO} ]; then | |
echo "$MONGODB_REPO found" | |
else | |
cat << 'EOF' > ${MONGODB_REPO} | |
[10gen] | |
name=10gen Repository |
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
#!/bin/bash | |
MONGODB_REPO="/etc/yum.repos.d/10gen-mongodb.repo" | |
CENTOS_REPO="/etc/yum.repos.d/CentOS-Base.repo" | |
EPEL_REPO="/etc/yum.repos.d/epel.repo" | |
PASSENGER_REPO="/etc/yum.repos.d/passenger.repo" | |
APP_ROOT="/opt" | |
[ -f "$APP_ROOT" ] || mkdir -p $APP_ROOT |
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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: tomcat | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: tomcat init script | |
# Description: tomcat init script | |
### END INIT INFO |
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
// When urlRoot or url does not meet URL requirement, override sync method | |
var MyModel = Backbone.Model.extend({ | |
sync : function(method, model, options) { | |
options || (options = {}); | |
if (method === 'read') { | |
options.url = '/path/to/read/api?id=' + encodeURIComponent(this.id); | |
} else if (method === 'create') { | |
options.url = '/path/to/create/api'; | |
} else if (method === 'update') { | |
options.url = '/path/to/update/api?id=' + encodeURIComponent(this.id); |
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 XyzView = Marionette.ItemView.extend({ | |
template : '#xyz-tpl', | |
ui : { | |
form : 'form' | |
}, | |
events : { | |
'click button.action' : 'onActionRequested', | |
'submit' : 'onActionRequested' |
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
// View 생성 시점에 Model/Collection을 fetch하는 경우, 로딩이 완료된 후에 화면을 표시해야 한다. | |
// LazyItemView는 Model 로딩이 완료되기 전까지 options에 설정된 emptyView를 표시한다. | |
// 이를 상속한 View는 Model 로딩이 완료되면 lazyLoadingCompleted를 호출한다. | |
App.LazyItemView = Marionette.ItemView.extend({ | |
constructor : function() { | |
_.bindAll(this, 'lazyLoadingCompleted'); | |
Marionette.ItemView.prototype.constructor.apply(this, arguments); | |
}, | |
render : function () { |
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
// http://twitter.github.com/bootstrap/javascript.html#modals | |
// http://lostechies.com/derickbailey/2012/04/17/managing-a-modal-dialog-with-backbone-and-marionette/ | |
var ModalRegion = Marionette.Region.extend({ | |
el : '#modal', | |
onShow : function(view) { | |
// 'hidden' - Bootstrap Modal event fired when the modal has finished being hidden from the user | |
this.$el.on('hidden', this.close); | |
view.on('close', this.hideModal, this); | |
this.showModal(view); |
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
// http://twitter.github.com/bootstrap/base-css.html#forms | |
// http://docs.jquery.com/Plugins/Validation/Validator/setDefaults#defaults | |
// https://github.com/twitter/bootstrap/issues/202 | |
jQuery.validator.setDefaults({ | |
errorClass: 'help-inline', | |
errorElement: 'span', | |
highlight:function(element, errorClass, validClass) { | |
$(element).parents('.control-group').addClass('error'); | |
}, | |
unhighlight: function(element, errorClass, validClass) { |
NewerOlder