Skip to content

Instantly share code, notes, and snippets.

View caherrerapa's full-sized avatar

Carlos Andres Herrera caherrerapa

View GitHub Profile

Keybase proof

I hereby claim:

  • I am caherrerapa on github.
  • I am caherrerapa (https://keybase.io/caherrerapa) on keybase.
  • I have a public key ASDEOBSpIGJDP0v1Thurf7HaJZHHI2jqAXEdYtSE4NT5igo

To claim this, I am signing this object:

require 'line/bot'
class CallbacksController < ApplicationController
def event_handler
signature = request.env['HTTP_X_LINE_CHANNELSIGNATURE']
unless client.validate_signature(request.body.read, signature)
error 400 do 'Bad Request' end
end
receive_request = Line::Bot::Receive::Request.new(request.env)
function openPaymentDialog(transactionId){
console.log(transactionId);
var airtime_form_div = document.createElement('div');
airtime_form_div.setAttribute('id', 'airtime_form');
var mdn_input_url = 'https://sandbox.codapayments.com/airtime/begin?host_url=' + encodeURIComponent(window.location) + '&txn_id=' + transactionId + '&client_type=1&client_time=' + new Date().getTime();
//var mdn_input_url = 'https://sandbox.codapayments.com/airtime/begin?host_url=https://www.zeemi.tv&txn_id=' + transactionId + '&client_type=1&client_time=' + new Date().getTime();
airtime_form_div.innerHTML = '<div><iframe id=\"airtime_iframe\" src=\"' + mdn_input_url + '\" scrolling=\"no\"></iframe></div>';
var body_el = document.getElementsByTagName("body")[0];
require 'faraday'
require 'net/http/digest_auth'
module Faraday
# Public: A Faraday middleware to use digest authentication. Since order of
# middlewares do care, it should be the first one of the Request middlewares
# in order to work properly (due to how digest authentication works).
#
# If some requests using the connection don't need to use digest auth you
/***************************************************
Refactor of Titanium Cache, by Guilherme Chapiewski - http://guilherme.it
Modified by Carlos Herrera carlos@jazzpay.co to follow NodeJS syntax and possible to use in Appcelerator Titanium
This is a simple Cache implementation for Titanium that uses local SQLite
database to cache strings and JavaScript objects.
More info at http://github.com/guilhermechapiewski/titanium-cache#readme
https://gist.github.com/caherrerapa/6425618
#!/usr/bin/env ruby
require "openssl"
require 'digest/sha2'
require 'base64'
# We use the AES 256 bit cipher-block chaining symetric encryption
alg = "AES-256-CBC"
# We want a 256 bit key symetric key based on some passphrase
digest = Digest::SHA256.new
@caherrerapa
caherrerapa / 01. Gemfile
Created December 5, 2012 18:14 — forked from schleg/01. Gemfile
Setup for Devise + Omniauth
gem 'pg'
group :development do
gem 'ruby-debug'
end
gem 'rake', '~> 0.8.7'
gem 'devise'
gem 'oa-oauth', :require => 'omniauth/oauth'
gem 'omniauth'
gem 'haml'
gem 'dynamic_form'
@caherrerapa
caherrerapa / mailer_rails
Created December 5, 2012 18:05
mailer_rails
SampleApp::Application.configure do
...
require 'tlsmail'
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.smtp_settings = {
:enable_starttls_auto => true,
:address => 'smtp.gmail.com',
@caherrerapa
caherrerapa / Twitter Bootstrap Navbar.html
Created November 15, 2012 23:31
HTML: Twitter boostrap navbar
Permissions
@caherrerapa
caherrerapa / HTML Twitter Bootstrap with menu and facebook
Created November 15, 2012 22:46
HTML: Twitter Bootstrap HTML 5
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">