Skip to content

Instantly share code, notes, and snippets.

View jesuslerma's full-sized avatar

jesuslerma

  • globalgig
  • Monterrey Mexico
View GitHub Profile
@jesuslerma
jesuslerma / iva_payment_entry.rb
Created December 30, 2015 23:28
Real testing
require 'rails_helper'
describe Contalink::Entries::IvaPaymentEntry do
@accounting_account = "IVA al Pago"
describe "#account_id" do
it "returns the accounting account id configured for #{@accounting_account}"
end
describe "#is_configured?" do
it "returns true when the accounting account is configured for #{@accounting_account}"
it "returns falsewhen when the accounting account is configured for #{@accounting_account}"
conn = Faraday.new(:url => 'http://jsonplaceholder.typicode.com') do |faraday|
faraday.request :url_encoded # form-encode POST params
faraday.response :logger # log requests to STDOUT
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
end
conn.get '/comments'
alphabet = ("a".."z").to_a << " "
key = 3
word = "hola mundo"
aux_arr = word.split("").map{|w| alphabet[(alphabet.index(w) + key) % alphabet.count] }
puts aux_arr.join("")
decrypt_arr = aux_arr.map{|w|alphabet[(alphabet.index(w) - key) % alphabet.count]}
@jesuslerma
jesuslerma / invoices_controller.rb
Created October 15, 2015 15:16
Como yo veo la solucion
def index
invoices_by_type
end
def sales
invoices_by_type
end
def expenses
invoices_by_type
end
def payroll
@jesuslerma
jesuslerma / query.sql
Last active September 23, 2015 15:10
SELECT conciliaciones.id AS id, st.id AS st_id, st.fecha, f.folio,
cuenta.numero_cuenta || '-' || cuenta.nombre AS nombre_cuenta,
(@ conciliaciones.dactual - conciliaciones.danterior) AS monto
FROM conciliaciones
INNER JOIN status_accounts st ON st.id = conciliaciones.status_account_id
LEFT JOIN facturas f ON f.id = conciliaciones.factura_id
LEFT JOIN (
SELECT concepto_contables.* FROM concepto_contables
LEFT JOIN concepto_contable_diots
ON concepto_contable_diots.concepto_contable_id = concepto_contables.id
@jesuslerma
jesuslerma / create_designs.rb
Created July 25, 2015 19:02
Shows how to create design row
Design.create(:image => File.open('/path/to/image.jpg', 'rb'), user_id:1,title:FFaker::HipsterIpsum.word)
[user]
name = Jesus Lerma
email = shuyojl@gmail.com
[alias]
h = log --pretty=format:'%Creset%C(red bold)[%ad] %C(blue bold)%h %Creset%C(magenta bold)%d %Creset%s %C(green bold)(%an)%Creset' --graph --abbrev-commit --date=short
ha = log --pretty=format:'%Creset%C(red bold)[%ad] %C(blue bold)%h %Creset%C(magenta bold)%d %Creset%s %C(green bold)(%an)%Creset' --graph --all --abbrev-commit --date=short
@jesuslerma
jesuslerma / routes.rb
Created July 13, 2015 20:37
Routes configuration for versionist
namespace :api, path: '/api' do
api_version(:module => "V1", :header => {:name => "Accept",
:value => "application/vnd.hsnews.com+json; version=1"},
:defaults => {:format => :json}, :default => true) do
end
end
def show
#..mandamos a llamar el servicio...
json_response = JSON.parse response, symbolize_names: true
json_response[:bindaryData] = Base64.encode64(json_response[:bindaryData])
respond_to do |format|
format.json {render json: json_response}
end
end
<ul class="nav nav-tabs">
<li class="active"><a href="#sections" data-toggle="tab">Secciones</a></li>
<!-- <li><a href="#revenues" data-toggle="tab">Ingresos vs Egresos</a></li> -->
</ul>
<div class="tab-content">
<div id="sections" class="tab-pane active">
<div class="row">
<div class="span2 offset10">
<a class="btn" role="button" href="#setting_modal"
data-toggle="modal">