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 traer_nueva_data(){ | |
$.getJSON("/data/"), function(request){ | |
//haces algo | |
} | |
} |
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
alvaro-pereyra-rabanals-macbook:bin alvaropereyrarabanal$ sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config | |
Password: | |
Building native extensions. This could take a while... | |
ERROR: Error installing mysql: | |
ERROR: Failed to build gem native extension. | |
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb | |
checking for mysql_query() in -lmysqlclient... no | |
checking for main() in -lm... yes | |
checking for mysql_query() in -lmysqlclient... no |
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 parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
function proml { | |
local BLUE="\[\033[0;34m\]" | |
local RED="\[\033[0;31m\]" | |
local LIGHT_RED="\[\033[1;31m\]" | |
local GREEN="\[\033[0;32m\]" | |
local LIGHT_GREEN="\[\033[1;32m\]" |
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
#Etags should be based on the file parameters only (default includes INode) | |
FileETag MTime Size | |
#Rewrite stuff | |
RewriteEngine On | |
#This sets the environment variable (is_versioned) when the URL query string | |
#looks like ?874353948543 or any string of digits | |
RewriteCond %{QUERY_STRING} ^[0-9]+$ | |
RewriteRule ^(.*)$ $1 [env=is_versioned: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
# ... bottom of your development.rb | |
if File.exists?(File.join(RAILS_ROOT,'tmp', 'debug.txt')) | |
require 'ruby-debug' | |
Debugger.wait_connection = true | |
Debugger.start_remote | |
File.delete(File.join(RAILS_ROOT,'tmp', 'debug.txt')) | |
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
StartServers 1 | |
ThreadsPerChild 10 | |
MaxClients 10 | |
MinSpareThreads 1 | |
MaxSpareThreads 1 | |
MaxRequestsPerChild 50000 | |
ThreadStackSize 500000 |
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 xenda_tinka | |
#los jugadores | |
partners = ["Angel","Alvaro","Daniel"].sort_by { rand } | |
#los premios | |
cards = %w(165 165 170) | |
#chocolateamos | |
cards = cards.sort_by { rand } |
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 ul_tag(collection,li_options = {},ul_options={}) | |
list_items = collection.map{|item| | |
result = yield(item) | |
content_tag(:li,result,li_options) | |
}.join | |
content_tag(:ul,list_items,ul_options) | |
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
var sys = require('sys') | |
var filename = process.ARGV[2]; | |
if (!filename) | |
return sys.puts("Usage: node node_logger.js filename"); | |
var tail = process.createChildProcess("tail", ["-f", filename]); | |
sys.puts("listening to file " + filename); | |
var http = require("http"); |
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 | |
# | |
# Find bloating passengers and kill them gracefully. Run from cron every minute. | |
# | |
# required for passenger since cron has no environment | |
ENV['HTTPD'] = 'httpd' | |
MEM_LIMIT = ARGV[0] || 500 | |
OlderNewer