This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def index | |
invoices_by_type | |
end | |
def sales | |
invoices_by_type | |
end | |
def expenses | |
invoices_by_type | |
end | |
def payroll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "class methods" do | |
describe ".calc_amount" do | |
it "returns 0 when the invoice amount is nil" | |
context "when the invoice status is 'Cancelado'" do | |
it "returns invoice total when the invoice has polizas for the company" | |
it "return 0.0 when the invoice doesnt has not polizas for the company" | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int array[100]; | |
for(int i = 0; i < array.length(); i ++) { | |
if (isFizz(array[i]) && isBuzz(array[i])) cout << "FizzBuzz" << endl; | |
else if ( isFizz(array[i])) cout << "Fizz" << endl; | |
else if (isBuzz(array[i])) cout << "Buzz" << endl; | |
} | |
bool isFizz(int elem) { | |
return ( elem % 3 == 0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def attr_redeable(attribute) | |
hash = { | |
:naturaleza => { | |
'1' => "Deudora", | |
'2' => 'Acreedora' | |
}, | |
:nivel_cuenta => { | |
'1' => 'Titulo', | |
'2' => 'Mayor', | |
'3' => 'Subcuenta', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Baby < RubyProgrammer | |
attr_accessor :age, :gender, :name | |
after_create :dad_will_be_happy | |
def dad_will_be_happy | |
puts 'Wohoo he\'s a boy' | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cherrypy | |
import boto | |
class Uploader(object): | |
@cherrypy.expose | |
@cherrypy.tools.json_out() | |
def index(self, myFile=None): | |
try: | |
FileValidator(myFile) | |
except ValueError as err: |