Skip to content

Instantly share code, notes, and snippets.

Boris Barroso boriscy

View GitHub Profile
@boriscy
boriscy / getUrlParams.js
Last active Nov 29, 2018
replace of jQuery.param
View getUrlParams.js
/**
* 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]
View tricks.exs
# Generate alphabet
for n <- ?a..?z, do: n
for n <- ?a..?z, do: << n :: utf8 >>
View a_b.csv
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
View SWIFT-BISA.md

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 Nov 29, 2017
Explicación de bonsaiERP
View transacción.md

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:

View option.rb
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
View messaging_service.ex
# 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 Nov 9, 2016
Define types on structs Elixir
View registration.ex
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 Aug 3, 2016
Guide for queries done on PostgreSQL
View queries.md

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 Jul 26, 2016
Download data for Permits and Plug for Ohio
View permit_and_plug_ohio.js
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',
You can’t perform that action at this time.