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 | |
# sidekiq Init script for Sidekiq | |
# chkconfig: 345 100 75 | |
# | |
# Description: Starts and Stops Sidekiq message processor for Stratus application. | |
# | |
# User-specified exit parameters used in this script: | |
# | |
# Exit Code 5 - Incorrect User ID | |
# Exit Code 6 - Directory not found |
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 countCSSRules() { | |
var results = '', | |
log = ''; | |
if (!document.styleSheets) { | |
return; | |
} | |
for (var i = 0; i < document.styleSheets.length; i++) { | |
countSheet(document.styleSheets[i]); | |
} | |
function countSheet(sheet) { |
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
#! /usr/bin/env ruby | |
# This small script uses the 'srt' gem to parse the srt file | |
# It solves problems with certain subtitle files with empty lines that make Flex crash | |
# You can use it with files, folders with files or even folders with subfolders with files (God bless Recursivity) | |
# USAGE: ruby fix-srt.rb file/to/fix.srt | |
# USAGE: ruby fix-srt.rb folder/with/files/to/fix | |
# USAGE: ruby fix-srt.rb folders/with/subfolders/to/fix | |
require 'rubygems' | |
require 'srt' |
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
require File.dirname(__FILE__) + '/config/environment' | |
run ActionController::Dispatcher.new |
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
config.to_prepare do | |
::Dragonfly[:images].configure do |c| | |
c.define_url do |app, job, opts| | |
thumb = Thumb.find_by_job(job.serialize) | |
if thumb | |
app.datastore.url_for(thumb.uid) | |
app.cache_duration = 3600*24*7 | |
else | |
app.server.url_for(job) | |
app.cache_duration = 3600 |
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
if ( !Array.prototype.include ) { | |
Array.prototype.include = function(element) { | |
for(var i = 0, len = this.length; i < len; ++i) { | |
if (this[i] == element) { return true; } | |
} | |
return false; | |
}; | |
} |
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 | |
# Change the iterm2 profile programatically | |
function iterm_profile { | |
if [[ -z $1 ]]; then | |
profile="Default" | |
else | |
profile=$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
/* Send a form with a link with data-form="#form_id" | |
/ You can define params="name,value name,value" | |
/ All params will be append to the form as hidden inputs before send it | |
*/ | |
$('body').on('click', '[data-form]', function(e) { | |
e.preventDefault(); | |
var el = $(this), | |
form = $(el.data('form')), | |
params; |
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 | |
cmd="sudo varnishadm -T localhost:6082 -S /etc/varnish/secret" | |
page=$(echo $1 | awk -F'/' -v OFS='/' '{sub(/https?:\/\//, ""); $1=""; print $0}') | |
if [ -z "$1" ]; then | |
echo "ERROR: please provide a URL to ban.." | |
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
String.prototype.datify = function() { | |
var months = "enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"), | |
// Date string to parse: 2012-02-16 22:02:30 GMT | |
date_string = this.split(' ')[0], | |
date_reverse = date_string.split('-').reverse(); | |
date_reverse[1] = months[date_reverse[1] -1]; | |
return date_reverse.join(' '); | |
}; |