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
# List all entries in an index | |
> http://localhost:9200/project_environment_users/_search?pretty=true&q=*:* | |
# Delete an index | |
> curl -XDELETE http://localhost:9200/project_environment_users |
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
# AppicationController... | |
before_filter :subdomain_view_path | |
private | |
def subdomain_view_path | |
prepend_view_path "app/views/#{request.subdomain}_subdomain" if request.subdomain.present? | |
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
# source: http://augustl.com/blog/2010/dynamic_session_expiration_time_in_rails_3/ | |
cookies[:thing] = {:value => {:normal => "session stuff"}, :expires => 2.hours.from_now} | |
# Signed cookies are encrypted with the apps secret_token. | |
cookies.signed[:login] = {:value => @user.id, :expires => 1.day.from_now} | |
# These calls are equivalent. | |
cookies[:foo] = {:value => "bar", :expires => 20.years.from_now} | |
cookies.permanent[:foo] = "bar" |
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
#Kill all mysql running instances | |
$ mysql --skip-grant-tables --skip-networking | |
$ mysql | |
mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root'; | |
mysql> FLUSH PRIVILEGES; |
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 Base | |
def self.set_menu_group(group_name) | |
class_eval <<-EOF | |
def menu_group | |
"#{group_name}" | |
end | |
EOF | |
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
def attempt_login | |
if authorized_user | |
if request.xhr? | |
render :json => { | |
:location => url_for(:controller => 'jobs', :action => 'index'), | |
:flash => {:notice => "Hello #{authorized_user.name}."} | |
} | |
else | |
redirect_to(:controller => 'jobs', :action => 'index') |
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 attribute_name | |
read_attribute(:attribute_name) | |
end | |
def attribute_name= (value) | |
write_attribute(:attribute_name, value) | |
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
sed -e 's/\(background.*url.*\)\.\./\1\/assets\/#{store_name}\//' public.css > temp.css |
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
# List the timezones | |
ls /usr/share/zoneinfo/ | |
# ls /usr/share/zoneinfo/America or ls /usr/share/zoneinfo/US | |
# Edit the file with the timezone name | |
sudo vi /etc/timezone | |
# America/Sao_Paulo for example | |
sudo dpkg-reconfigure --frontend noninteractive tzdata |
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
-> % ruby -e 'Dir.glob("*.css").each{|f| system("sed -i -e \"s/img\\//images\\//g\" #{f} && rm #{f}-e")}' |
OlderNewer