Skip to content

Instantly share code, notes, and snippets.

View lporras's full-sized avatar
🏠
Working from home

Luis Alfredo Porras Páez lporras

🏠
Working from home
View GitHub Profile
@lporras
lporras / README.md
Last active January 2, 2016 21:34 — forked from jimothyGator/README.md
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default and default-ssl to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
@lporras
lporras / angie bugs selfie.md
Last active August 29, 2015 14:07
angie bugs selfie
  • cuando haces un reply a un selfie q no tiene replies, se demora en aparecer ese reply en la pantalla de conversación

  • al tratar de hacer un selfie sin permisos de micrpfono y camara, dar ok al mensaje, salir del app, habilitar permisos, al entrar nuevamente no conservó la sesión

  • los botones de ok al grabar un selfie y escoger un cover deberian indicar paso siguiente,

  • candado de publico a privado no funciona en ipad mini ios 8.0

  • al entrar a ver mis liked selfies, veo los selfies en orden descendente por fecha de like, pero si hago un nuevo like a un selfie más antiguo q mi liked selfie recien, el nuevo selfie liked reemplaza a los primeros likes.

@lporras
lporras / upload_helpers.rb
Created May 27, 2014 20:34
upload direct s3 helpers
# Helpers
def uploader
@uploader ||= ImageUploader.new
end
def policy
conditions = [
["starts-with", "$utf8", ""],
# Change this path if you need, but adjust the javascript config
["starts-with", "$key", "uploads"],
["starts-with", "$filename", ""],
@lporras
lporras / plupload_direct.js
Last active August 29, 2015 14:01
Plupload direct s3
// Esto lo he probado con Plupload v. 2.1.1
// deben cambiar la forma en que se hacen los binding de eventos de plupload, seguir el ejemplo:
//http://www.plupload.com/examples/core
// Esto debe ir en el html para poder acceder a los helpers de rails
App.pluploadConfig = {
url: "https://neufert-tmp-cdn.archdaily.net.s3.amazonaws.com/",
/* try replacing file_name_name: false by send_file_name: false
if dont work then modify plupload with:
...

some tricky test moments in Jasmine

If you know RSpec, Jasmine is easy! But some common uses of JavaScript may not be as immediately obvious.

Try to use Jasmine (you could use your own setup or just tryjasmine.com) to write some specs that cover cases like these. The links will load up an example.

@lporras
lporras / collection_select_input.rb
Created April 21, 2014 14:23
Chosen para select simple_form
# app/inputs/collection_select_input.rb
class CollectionSelectInput < SimpleForm::Inputs::CollectionSelectInput
def input_html_classes
super.push('chosen-select')
end
def html_options_for(namespace, css_classes)
{data: {:placeholder => I18n.t("helpers.select.prompt")}}.merge!(super(namespace, css_classes))
end
end
@lporras
lporras / gist:10513138
Created April 12, 2014 01:10
guardar imagen
dirname = File.dirname(self.image_tmp)
path = Rails.root.join "tmp/uploads", dirname
file_with_path = Rails.root.join "tmp/uploads", self.image_tmp
FileUtils.mkdir_p(path)
File.open(file_with_path, "wb") { |f| f.write(open(URI.parse(url)).read) }
describe "account already exists" do
before :each do
set_omniauth
visit "/catalog/users/auth/archdaily"
sleep(1)
#page.status_code.should be(302)
current_path.should == "/catalog/after_signup/complete_profile"
user = FactoryGirl.attributes_for(:user)
account = FactoryGirl.create(:account, name: user[:account_name])
fill_in 'account_name', :with => user[:account_name]
@lporras
lporras / Wordpress_snippets.rb
Created May 16, 2013 17:07
Methods to transform wordpress snipetts
#gem "acts_as_unvlogable" , git: "git://github.com/michelson/acts_as_unvlogable.git"
String.class_eval do
# Transformer Captions like
# [caption id="attachment_18994" align="alignnone" width="528" caption="perspectiva Roller Contract T 140"]
# CONTENT
# [/caption]
# into
# <div id="attachment_18994" class="wp-caption alignnone" style="width:528px;">
# CONTENT
@lporras
lporras / wpautop.rb
Last active December 17, 2015 08:28 — forked from goofmint/wpautop for ruby
def wpautop(pee, br = true)
return '' if pee.strip == ''
pee = "#{pee}\n" # just to make things a little easier, pad the end
pee = pee.gsub(/<br \/>\s*<br \/>/, "\n\n")
# pace things out a little
allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|option|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)';
pee = pee.gsub(Regexp.new('(<'+allblocks+'[^>]*>)'), "\n"+'\1')
pee = pee.gsub(Regexp.new('(<\/'+allblocks+'[^>]*>)'), '\1' + "\n\n")
pee = pee.gsub(/\r\n|\r/, "\n") # cross-platform newlines
if pee.include?('<object')