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
sed "s/,/\\`echo -e '\n\r'`/g" |
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 ($request_uri = /) { | |
set $test A; | |
} | |
if ($host ~* teambox.com) { | |
set $test "${test}B"; | |
} | |
if ($http_cookie !~* "auth_token") { | |
set $test "${test}C"; |
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
plugin.onMessageInsertion = function (event) { | |
var content; | |
content = Talker.getLastInsertion().replace(/:[\w_+]+:/g, function (match) { | |
var emoji = match, | |
filename = (emoji == ':+1:' ? ':plus1:' : emoji).replace(/:/g, ''); | |
return "<img class=\"emoji\" title=\"" + emoji + "\" alt=\"" + emoji + "\" height=\"20\" width=\"20\" align=\"absmiddle\" src=\"https://teambox.com/assets/emojis/" + filename + ".png\">" | |
}); | |
return content; | |
}; |
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
def remove_failed_jobs_if(&block) | |
i = 0 | |
while i < Resque::Failure.count | |
job = Resque::Failure.all(i) | |
if yield job | |
Resque::Failure.remove(i) | |
else | |
i += 1 | |
end | |
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
# Ported from https://github.com/jzaefferer/jquery-validation/blob/master/jquery.validate.js | |
creditcard = (value) -> | |
# accept only spaces, digits and dashes | |
if /[^0-9 \-]+/.test(value) | |
return false | |
nCheck = 0 | |
nDigit = 0 | |
bEven = 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
screen # Starts a screen session | |
<C-a d> # Detaches from the screen session | |
screen -r # Reattaches to a detached session | |
screen -S paco # Starts a screen session called "paco" | |
screen -r paco # Reattaches to a detached session called "paco" |
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
# /etc/ssh/sshd_config | |
TCPKeepAlive yes | |
ClientAliveInterval 15 | |
ClientAliveCountMax 5 |
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 cat /var/log/nginx/access.log | cut -f 9 -d" " | sort | uniq -c |
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 local_hash = window.location.hash.substr(1), | |
hash_value = local_hash.substr(local_hash.indexOf(key + '=')).split('&')[0].split('=')[1], | |
Data = {}; | |
// Once OAuth handshake is done, we'll be redirected with a hash string in the location that we'll use to extract the token | |
if (hash_value) { | |
Data.access_token = hash_value; | |
call_api("organizations", {}, function (data) { | |
console.log(data); // Here you have your organizations |
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
namespace :datamodel do | |
desc 'Generates data model in erd.pdf' | |
task :generate do | |
#say 'Loading application environment...' | |
Rake::Task[:environment].invoke | |
require 'rails_erd/diagram/graphviz' | |
#say 'Loading all models...' | |
Rails.application.eager_load! | |
::Rails::Engine.subclasses.map(&:instance).map {|e| e.class.eager_load!} |