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
machine: | |
ruby: | |
version: 2.2.3 | |
general: | |
branches: | |
only: | |
- master | |
- develop |
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
# See http://wiki.nginx.org/HttpUploadModule | |
location = /upload-restore-archive { | |
# if resumable uploads are on, then the $upload_field_name variable | |
# won't be set because the Content-Type isn't (and isn't allowed to be) | |
# multipart/form-data, which is where the field name would normally be | |
# defined, so this *must* correspond to the field name in the Rails view | |
set $upload_field_name "archive"; | |
# location to forward to once the upload completes |
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 | |
# hubot | |
# chkconfig: 345 20 80 | |
# description: hubot | |
# processname: hubot | |
# REFERENCE: http://werxltd.com/wp/2012/01/05/simple-init-d-script-template/ | |
# This script assumes you have a user called "hubot" on your system and that hubot is installed in /opt/hubot |
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
function camelize(str) { | |
return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function (letter, index) { | |
return index == 0 ? letter.toLowerCase() : letter.toUpperCase(); | |
}).replace(/\s+/g, ''); | |
} | |
$.fn.extend({ | |
dataGrouping: function (attributeName) { | |
var regExp = new RegExp('^' + attributeName), | |
attributesFound = {}; |
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
(function (factory) { | |
if (typeof define === "function" && define.amd) { | |
define( ["jquery"], factory ); | |
} else { | |
factory( window.jQuery ); | |
} | |
}(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
Error.custromConstructor = (function() { | |
function define(obj, prop, value) { | |
Object.defineProperty(obj, prop, { | |
value: value, | |
configurable: true, | |
enumerable: false, | |
writable: true | |
}); | |
} |
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
class ApplicationController | |
before_filter :redirect_if_old | |
# before_action :redirect_if_old # if Rails 4+ | |
protected | |
def redirect_if_old | |
if request.host == 'old.com' | |
redirect_to "#{request.protocol}new.io#{request.fullpath}", :status => :moved_permanently | |
end |
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
function MyError(code, msg) { | |
this.message = msg; | |
this.statusCode = code; | |
this.name = 'HttpError'; | |
const err = Error(msg); | |
this.stack = err.stack; | |
} | |
MyError.prototype = Object.create(Error.prototype); | |
MyError.prototype.constructor = MyError; |
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 images = document.querySelectorAll('img[data-src]'), | |
imageLength = images.length; | |
Array.prototype.forEach.call(images, function(image) { | |
image.setAttribute('src', image.getAttribute('data-src')); | |
image.onload = function() { | |
image.removeAttribute('data-src'); | |
}; | |
}); |
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 indexOf = function(needle) { | |
if(typeof Array.prototype.indexOf === 'function') { | |
indexOf = Array.prototype.indexOf; | |
} else { | |
indexOf = function(needle) { | |
var i = -1, | |
index = -1; | |
for(i = 0; i < this.length; i++) { | |
if(this[i] === needle) { | |
index = i; |