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
<session-config> | |
<cookie-config> | |
<http-only>true</http-only> | |
</cookie-config> | |
</session-config> |
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
public class Something { | |
private Something() { | |
} | |
private static class LazyHolder { | |
private static final Something INSTANCE = new Something(); | |
} | |
public static Something getInstance() { | |
return LazyHolder.INSTANCE; |
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) { |
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
// 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
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
// 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
#! /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
#!/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/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 |
OlderNewer