Skip to content

Instantly share code, notes, and snippets.

Francisco Guzmán panchew

Block or report user

Report or block panchew

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View signature_components.js
$.each box, (key, value) ->
# Insert a container with a 'Click to sign' button that replaces the signature (mobile devices)
mobileSignatureContainer = '<div id="mobile-signature-container">'
mobileSignatureContainer += '<img id="signature_img_' + $(value).data('component-id') + '" class="signature-img" data-component-id="'
mobileSignatureContainer += $(value).data('component-id') + '"><br/>'
mobileSignatureContainer += '<a href="#" id="sign_button_' + $(value).data('component-id') + '" class="btn btn-info btn-xs mobile-sign-button" '
mobileSignatureContainer += 'data-component-id="' + $(value).data('component-id') + '">Click to sign</a>'
mobileSignatureContainer += '</div>'
$(value).parent().before(mobileSignatureContainer)
@panchew
panchew / heroku_rails_phantomjs.md
Created Aug 7, 2016 — forked from edelpero/heroku_rails_phantomjs.md
Heroku, Ruby on Rails and PhantomJS
View heroku_rails_phantomjs.md

#Heroku, Ruby on Rails and PhantomJS

In this post, I’m going to show you how to modify an existing Ruby on Rails app running on Heroku’s Cedar stack to use PhantomJS for screen scraping. If you’ve never heard of PhantomJS, it’s a command-line WebKit-based browser (that supports JavaScript, cookies, etc.).

Let’s get started. This is a high-level overview of the required steps:

  • Modify your app to use multiple Heroku buildpacks.
  • Extend your app to use both the Ruby as well as the PhantomJS buildpacks.
  • Confirm that everything worked.
View Postmark Webhook strategy
A library that uses the Postmark-Server-Token:
- It should handle POST requests with data of the bounce
- It should parse the params to create an ActiveRecord instance and store the data in a DB
- It should return a status code to the webhook
- It should have logic to (maybe?) have external input to decide to attempt re-send (activate)
View PostMark API library
module PostMark
class API
include HTTParty
base_uri 'https://api.postmarkapp.com'
attr_accessor :token
# X-Postmark-Server-Token
def initialize(token)
View PostMark strategy
A library that uses the Postmark-Server-Token:
- It should get delivery stats (to parse them by Type and detect whether or not iterate over bounces)
- It should get bounces (for those types whose count is greater than zero)
- It should get single bounce to parse details
- It should have logic to (maybe?) have external input to decide to attempt re-send (activate)
# I like using HTTParty but Typhoeus could work very well here.
View Code-Controller analisys
Client::PortalController analysis.
What does it do?
It seems to take care of the requests related to proposals. It has an action that takes care of both showing and previewing a proposal (the type of viewing gets chosen in #info action. It also has #index but the way the controller is implemented doesn't seemt to be RESTful (not a resource in the routes file).
I can see there is logic enable via includes that could enable the 'presenter' design pattern, and in the #canvas action, I can see a bit of the 'template' design pattern, and also I can see there are calls to Amazon S3 service; also the proposals states and acceptance are handled by this controller as well as comments related to a single proposal. I noticed mailer logic for several actions: acceptance, set_status and show (although I can't see why ClientEmailer.deliver_proposal_accepted(proposal) is called in two different actions.
What I like about it.
View survey_output.yml
---
result_ok: true
data:
id: "630114"
team: "0"
_type: Survey
_subtype: Standard Survey
status: Launched
created_on: 2011-09-06 20:48:04
modified_on: 2011-09-07 13:17:23
@panchew
panchew / rspec_output
Created May 21, 2011
I am SOOOO fired
View rspec_output
ETL environment loaded
........
.FF.....FF..FF....FFFFFFFFFFFFF.............FF.F...........................F.......................................................F...............................................F........................F........................F...............FF...F.........FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.....
7:13 PM
Finished in 167.74 seconds
566 examples, 322 failures
@panchew
panchew / gist:661917
Created Nov 3, 2010
WatermarkConsoleOutputAfterTweak
View gist:661917
>> example_image_path = "#{RAILS_ROOT}/public/images/wallpaper_original.jpg"
=> "/Users/flamaspeed/creative-allies/public/images/wallpaper_original.jpg"
>> example_image_output_path = "#{RAILS_ROOT}/public/images/wallpaper_watermarked.jpg"
=> "/Users/flamaspeed/creative-allies/public/images/wallpaper_watermarked.jpg"
>> apply_watermark(example_image_path, example_image_output_path)
user system total real
0.090000 0.030000 0.120000 ( 10.781697)
user system total real
0.030000 0.030000 0.060000 ( 1.791267)
=> #<Magick::Image: (destroyed)>
@panchew
panchew / gist:661883
Created Nov 3, 2010
WatermarkConsoleOutput
View gist:661883
>> example_image_path = "#{RAILS_ROOT}/public/images/wallpaper_original.jpg"
=> "/Users/flamaspeed/creative-allies/public/images/wallpaper_original.jpg"
>> example_image_output_path = "#{RAILS_ROOT}/public/images/wallpaper_watermarked.jpg"
=> "/Users/flamaspeed/creative-allies/public/images/wallpaper_watermarked.jpg"
>> apply_watermark(example_image_path, example_image_output_path)
user system total real
0.020000 0.040000 0.060000 ( 1.123081)
user system total real
0.020000 0.010000 0.030000 ( 0.048455)
user system total real
You can’t perform that action at this time.