Skip to content

Instantly share code, notes, and snippets.

View jorgeacaballero's full-sized avatar
🎯
Focusing

Jorge Caballero jorgeacaballero

🎯
Focusing
View GitHub Profile
import collections
def get_flat_int_array(input):
for item in input:
# check if its an array
if isinstance(item, collections.Iterable):
# if it is, apply recursive
for sub_array in get_flat_int_array(item):
yield sub_array
else:
posts = [p for p in posts if p.title != ""]
@jorgeacaballero
jorgeacaballero / mina-deploy
Created January 27, 2016 17:42
Mina deploy output
mina deploy
deploy@162.243.30.212's password:
-----> Using RVM environment 'ruby-2.2.1@default'
= rvm
* https://rvm.io/
* https://github.com/wayneeseguin/rvm/
== DESCRIPTION:
@jorgeacaballero
jorgeacaballero / deploy.rb
Last active January 27, 2016 17:28
Mina Deploy Config
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
# require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
require 'mina/rvm' # for rvm support. (http://rvm.io)
# Basic settings:
# domain - The hostname to SSH to.
# deploy_to - Path to deploy into.
# repository - Git repo to clone from. (needed by mina/git)
@jorgeacaballero
jorgeacaballero / output
Last active January 27, 2016 15:25
RVM Installation Output
deploy@ubuntu-512mb-nyc2-01:~$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
gpg: directory `/home/deploy/.gnupg' created
gpg: new configuration file `/home/deploy/.gnupg/gpg.conf' created
gpg: WARNING: options in `/home/deploy/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/home/deploy/.gnupg/secring.gpg' created
gpg: keyring `/home/deploy/.gnupg/pubring.gpg' created
gpg: requesting key D39DC0E3 from hkp server keys.gnupg.net
gpg: /home/deploy/.gnupg/trustdb.gpg: trustdb created
gpg: key D39DC0E3: public key "Michal Papis (RVM signing) <mpapis@gmail.com>" imported
gpg: no ultimately trusted keys found
@jorgeacaballero
jorgeacaballero / trace.log
Created August 31, 2015 20:15
Precompile log
bundle exec rake assets:precompile RAILS_ENV="production" --trace
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
I, [2015-08-31T16:14:21.280373 #1489] INFO -- : Writing /home/rails/client-portal/public/assets/active_admin-d8622bdaf9113ddf7612d53b1135dee0cfce37d0a4d7e786ec70fccdaf4ffe66.css
I, [2015-08-31T16:14:21.455444 #1489] INFO -- : Writing /home/rails/client-portal/public/assets/active_admin/print-87c5ffc1d869a919123bcc1dc5ec51b20bc79fd9aeab9eed77e3438c6acd4f68.css
I, [2015-08-31T16:14:30.768568 #1489] INFO -- : Writing /home/rails/client-portal/public/assets/active_admin-e53082549a923865a9b59d3b3bbfd9c2ed15ee16726dba0adcb7feef15366b83.js
2015-08-31T15:54:04.450394 #1285] INFO -- : Started GET "/" for x.x.x.x at 2015-08-31 15:54:04 -0400
I, [2015-08-31T15:54:04.457939 #1285] INFO -- : Processing by Devise::SessionsController#new as HTML
D, [2015-08-31T15:54:04.461533 #1285] DEBUG -- : Plan Load (0.5ms) SELECT "plans".* FROM "plans" ORDER BY "plans"."id" DESC LIMIT 1
I, [2015-08-31T15:54:04.479932 #1285] INFO -- : Rendered devise/sessions/new.html.erb within layouts/application (16.2ms)
I, [2015-08-31T15:54:04.503950 #1285] INFO -- : Completed 500 Internal Server Error in 46ms
F, [2015-08-31T15:54:04.507037 #1285] FATAL -- :
ActionView::Template::Error (source sequence is illegal/malformed utf-8):
5: <title><%= content_for?(:title) ? yield(:title) : "Title" %></title>
6: <meta name="description" content="<%= content_for?(:description) ? yield(:description) : "Title" %>">
7: <%= stylesheet_link_tag 'application', media: 'all' %>
ActiveAdmin.register Estate, as: "Inmueble", namespace: :provider do
permit_params :name, :price, :kind, :ground_area, :max_period, :common_area, :special_attr, :max_down, :room_number, :capital_gain, :ground_unit, :special_offer, :construction_unit, :construction_area, :city, :address, :gposition, :description, :sold, :new, :project_id, :real_estate_id, images_attributes: [:description, :picture, :id]
scope("All", default: true) { |scope| scope.where(real_estate_id: current_provider_user.real_estate_id) }
before_build do |record|
record.real_estate_id = current_provider_user.real_estate_id
record.visible = false
end
syntax error, unexpected ',', expecting keyword_end
...rovider_user.real_estate_id) }, default: true
... ^
ActiveAdmin.register Estate, as: "Inmueble", namespace: :provider do
permit_params :name, :price, :kind, :ground_area, :max_period, :common_area, :special_attr, :max_down, :room_number, :capital_gain, :ground_unit, :special_offer, :construction_unit, :construction_area, :city, :address, :gposition, :description, :sold, :new, :project_id, :real_estate_id, images_attributes: [:description, :picture, :id]
scope("All") { |scope| scope.where(real_estate_id: current_provider_user.real_estate_id) } #, default: true
before_build do |record|
record.real_estate_id = current_provider_user.real_estate_id
record.visible = false
end