Skip to content

Instantly share code, notes, and snippets.

View mayra-cabrera's full-sized avatar
💃
Nothing to do here. Go to https://gitlab.com/mayra-cabrera instead

Mayra Cabrera mayra-cabrera

💃
Nothing to do here. Go to https://gitlab.com/mayra-cabrera instead
View GitHub Profile
@mayra-cabrera
mayra-cabrera / gist:cbba64a1144436544275
Created December 11, 2014 19:24
Clear cache from production/staging server

Running something like

 bundle install --without nothing 

should clear the cache, not sure if it is recommended though. This is one seems a lot better

 rm .bundle/config

See this issue apparently it was already fix :D

  • Ubuntu: 14.10 utopic
  • PostgreSQL 8.4, 9.0, 9.1, 9.2, 9.3, 9.4 beta

I started getting “Failed to fetch” error messages when updating the software sources:

Failed to fetch http://ppa.launchpad.net/pitti/postgresql

which may be due to a bug related to a clean up in Launchpad’s PPAs. After serveral hours -.-, Here is what I finally works

In the terminal open the file located at /etc/apt/sources.list.d

true ? "true" : "false"
false ? "true" : "false"
nil ? "true" : "false"
1 ? "true" : "false"
0 ? "true" : "false"
"false" ? "true" : "false"
"" ? "true" : "false"
[] ? "true" : "false"
class DummyClass
def self.im_awesome
end
def my_awesome_method
end
end
# En cada uno de los ejemplos, ¿cuál es el valor final de 'a'?
# Ejemplo 1
a = nil
b = 2
a ||= b
# Ejemplo 2
a = false
b = 2
# Ejemplo 1
def mixed_args(a,b,*c,d)
puts "Arguments:"
p a,b,c,d
end
# ¿Cuál es la salida de este método?
# mixed_args(1,2,3,4,5)
# Ejemplo 2
def args_unleashed(a,b=1,*c,d,e)
@mayra-cabrera
mayra-cabrera / gist:5cf1ddc7bdf06ca0b240
Last active August 29, 2015 14:13
Question 6 - Routes
resources :posts do
member do
get 'comments'
end
collection do
post 'mark_as_archived'
end
end
# ¿Qué rutas genera?

Suponiendo la siguiente información en una base de datos:

Employee

Id name organization_id
1 Kaitlin 1
2 Vidal 1
3 Eliza 2
class Person
attr_accessible :first_name, :last_name
has_many :pets
end
class Pet
attr_accessible :name, :person_id
belongs_to :person
end
@mayra-cabrera
mayra-cabrera / gist:d5852b479b33c5f55206
Created January 15, 2015 00:01
PG::ConnectionBad - could not connect to server: Connection refused

I don't yet know why, but installing Mavericks removes some directories in /usr/local/var/postgres.

To fix this you simply recreate the missing directories:

mkdir /usr/local/var/postgres/pg_tblspc
mkdir /usr/local/var/postgres/pg_twophase
mkdir /usr/local/var/postgres/pg_stat_tmp

Or in one line: