Skip to content

Instantly share code, notes, and snippets.

View boriscy's full-sized avatar
馃彔
Working from home

Boris Barroso boriscy

馃彔
Working from home
  • Lead With Purpose
  • Samaipata, Bolivia
View GitHub Profile
@boriscy
boriscy / getUrlParams.js
Last active November 29, 2018 15:26
replace of jQuery.param
/**
* Converts an Object to params similar to jQuery.param function
* @param {Object} params
* @param {Array} keys
* @return {String}
*/
getUrlString (params, keys = [], isArray = false) {
const p = Object.keys(params).map(key => {
let val = params[key]
# Generate alphabet
for n <- ?a..?z, do: n
for n <- ?a..?z, do: << n :: utf8 >>
@boriscy
boriscy / a_b.csv
Last active February 23, 2018 15:56
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 45 columns, instead of 40 in line 2.
id,WellID,SideTrack,WorkType,Slant,APDNumber,APDReceivedDate,APDReturnDate,APDApprovedDate,APDExtDate,APDRescindDate,DrySpud,RotarySpud,WCRCompletionDate,SundryIntentReceivedDate,SundryIntentAcceptedDate,SundryIntentApprovedDate,SundryIntentCancelledDate,SundrySubsequentReceivedDate,SundryCompletionDate,WellStatusReport,WellTypeReport,FirstProdDate,TestDate,ProductionMethod,Choke64th,TubingPressure,CasingPressure,OilRate,GasRate,WaterRate,OilGravity,BTU,Cored,DST,DirSurveyRun,CompletionType,MD,TVD,PBMD,PBTVD,CurrentWellStatus,CurrentWellType,Confidential,doc
2782,4301330024,0,DRILL,NULL,10002063,NULL,NULL,09/12/1969,NULL,NULL,10/29/1969,NULL,02/15/1970,NULL,NULL,NULL,NULL,NULL,NULL,P,OW,02/18/1970,02/18/1970,Pumping,28,250,225,360,0,0,36.8,NULL,No,Yes,No,NULL,11232,11232,11100,11100,PA,OW,,A
2786,4301330024,1,REPERF,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10/22/1975,NULL,NULL,NULL,NULL,10/31/1975,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NUL,NULL,NULL,NULL,NULL,N

Bank: Banco BISA S.A.

Bank Address: Calle Ramon Loayza N. 178 ZONA CENTRAL

LA PAZ - BOLIVIA

SWIFT Code: BANIBOLXXXX

Bank account: 090873-501-3

@boriscy
boriscy / transacci贸n.md
Created November 29, 2017 15:07
Explicaci贸n de bonsaiERP

Bonsai usa una caracteristica de ppostgresql llamada schemas cada schema puede almacener todas las tablas de una organizacion, cuando se crea una nueva organizacion se crea todas las tablas, por ejemplo si creo la organizaci贸n mi org el schema sera mi_org y tendra las tablas solo para esa organizacion, es como tener otra base de datos con las mismas tablas que la principal.

Para poder integrar con un ingreso el modulo de facturacion hay que relacionarlo con Income entonces cuando entres en la vista del Income que seria incomes/:id puedes adicionar un bot贸n que diga crear factura, en factura almacenas.

Las tablas relacionadas para un Income son:

class Option < ActiveRecord::Base
validates :key , :presence => {:message => '<span style= "color: red">Es necesario este Campo</span>'}
validates :key, :uniqueness => { :message => '<span style= "color: red">Ya se establecio el valor de este parametro.</span>'}
enum prime: [:no,:yes]
enum quote: [:quote_1]
VALUES_BY_DEFAULT = %w(shopping_cart_default_value
shopping_cart_max_value
minimun_weight_product
limit_quantity_product
maximun_number_product_cart
# web/services/messaging_service.ex
defmodule Publit.MessagingService do
@moduledoc """
Service to send notifications to the user
"""
@message_api Application.get_env(:publit, :message_api)
def status_code(resp) do
{_s, msg} = resp
{:error, msg}
@boriscy
boriscy / registration.ex
Created November 9, 2016 01:24
Define types on structs Elixir
defmodule Registration do
defstruct [:email, :password, :name, :category, :address]
@type t :: %RegistrationService{
email: String.t,
password: String.t,
name: String.t,
category: String.t,
address: String.t
}
@boriscy
boriscy / queries.md
Last active August 3, 2016 14:45
Guide for queries done on PostgreSQL

JSON, JSONB

Select inside a json field with array

select f.id, f.file_name, p->'trade_name' as trade_name, m->'cin_add' as cin_add
from frac_reports f, jsonb_array_elements((f.data->>'products')::jsonb) p,
jsonb_array_elements(p->'materials') m
where f.id = 65933
@boriscy
boriscy / permit_and_plug_ohio.js
Created July 26, 2016 19:31
Download data for Permits and Plug for Ohio
var casper = require('casper').create();
var url = 'http://apps.ohiodnr.gov/oilgas/rbdmsreports/Downloads_PermitAndPlug.aspx';
casper.userAgent("Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36");
casper.start(url);
casper.then(function(arg) {
//this.capture('a.png', {top: 100, left: 100, width: 700, height: 500});
this.fillSelectors('#aspnetForm', {
'#ctl00_ContentPlaceholder1_rdp_ApplicationIssuedStart_dateInput': '12/1/2014',