Thursday, 17 May 2012

mysql cheatsheet


# Print the query result into a file
mysql> select * into outfile '/tmp/new.txt' from users;

# show the current database
mysql> select database();

Thursday, 3 May 2012

get out of the filter bubble

Google personalizes the results of your query and so do many others. In Google this can be avoided adding
&pws=0
to the end of your search URL in the search bar. Useful for SEO.

Disclaimer: You can't get out of all of the filters bubble.

Wednesday, 2 May 2012

define class methods in ruby (private too)

The following syntax could be used for defining the find method itself, but it is mandatory for alias.
class Item
  def self.find(name)
    # ...
  end

  class << self
    alias :search :find
  end

  private_class_method :find # writing it below private is not enough
end