apt-get install -y build-essential wget zlib1g-dev libssl-dev libffi-dev \
libyaml-dev libreadline6 libreadline6-dev libncurses5 \
libncurses5-dev libcurl4-openssl-dev mysql-client \
libmysqlclient-dev libmagickcore-dev imagemagick \
libxml2-dev libxslt1-dev curl git zsh
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
git fetch origin | |
git reset --hard origin/master |
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 autocomplete | |
query = params[:q] | |
@data = SearchService.autocomplete(query) | |
render text: render_to_string(:action => "partials/_autocomplete.html.erb", :layout => false, data: @data) | |
end | |
# $.get( search_autocomplete_url, {q: query}, function(res) { | |
# $("#search-container").html(res); | |
# }) | |
# .fail(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
# Dependencias | |
sudo apt-get update | |
sudo apt-get install build-essential libssl-dev curl libcurl3 libreadline-dev libcurl4-openssl-dev libffi-dev libgdbm3 libgdbm-dev nginx | |
# Install Java | |
sudo apt-get install default-jre | |
# NodeJS | |
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - | |
sudo apt-get install -y nodejs |
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
<!-- Facebook Pixel Code --> | |
<script> | |
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod? | |
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n; | |
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0; | |
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window, | |
document,'script','https://connect.facebook.net/en_US/fbevents.js'); | |
fbq('init', '869761073129850'); | |
fbq('track', 'PageView'); | |
</script> |
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
# Install dependencies | |
sudo apt-get install build-essential libssl-dev libreadline-dev zlib1g-dev git curl git-core nginx | |
# Install rbenv | |
git clone https://github.com/rbenv/rbenv.git ~/.rbenv | |
cd ~/.rbenv && src/configure && make -C src | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' | |
~/.rbenv/bin/rbenv init |
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 paypal_method | |
transaction_subject = clean_param params[:transaction_subject] | |
end | |
def clean_param value | |
return '' if value.nil? | |
value.to_s.encode('UTF-8', :invalid => :replace, :undef => :replace) | |
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
query = 'Ab' | |
User.where(name: query) #Exact match | |
User.where(name: /.*#{query}.*/) # Case sensitive, as LIKE operator | |
User.where(name: /.*#{query}.*/i) # Case sensitive, as iLIKE operator | |
# LIKE OR LIKE | |
User.any_of({first_name: /.*#{query}.*/i}).any_of({ last_name: /.*#{query}.*/i }) | |
# Don`t forget the .to_a method |
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
# RemoveAccents version 1.0.3 (c) 2008-2009 Solutions Informatiques Techniconseils inc. | |
# | |
# This module adds 2 methods to the string class. | |
# Up-to-date version and documentation available at: | |
# | |
# http://www.techniconseils.ca/en/scripts-remove-accents-ruby.php | |
# | |
# This script is available under the following license : | |
# Creative Commons Attribution-Share Alike 2.5. | |
# |
- PostgreSQL error 'Could not connect to server: No such file or directory' http://stackoverflow.com/questions/12472988/postgresql-error-could-not-connect-to-server-no-such-file-or-directory
- PostgreSQL error: Fatal: role “username” does not exist https://stackoverflow.com/questions/11919391/postgresql-error-fatal-role-username-does-not-exist
- Variables de entorno en Ubuntu: /etc/enviroment
- create role APPNAME with createdb login password 'SECRET_PASS';
- Assets not found: config.public_file_server.enabled = true
- Compilar assets en producción: bundle exec rake assets:precompile RAILS_ENV=production
- init.d scripts: https://gist.github.com/naholyr/4275302
- Eliminar script desde upstart: update-rc.d -f "$NAME" remove
- Capybara-webkit sin xvfb-run -a : https://github.com/leonid-shevtsov/headless