Skip to content

Instantly share code, notes, and snippets.

View arbo-hacker's full-sized avatar

Alejandro Barreto arbo-hacker

View GitHub Profile
@arbo-hacker
arbo-hacker / TestsFail.swift
Last active October 27, 2017 22:15
Como escribir una prueba unitaria para una funcion que usa Alamofire
import XCTest
class TestsFail: XCTestCase {
func testGettingJSON() {
Request.sharedInstance.getAllData { (error, result) in
XCTAssertNil(error)
XCTAssertNotNil(result)
ex.fulfill()
@arbo-hacker
arbo-hacker / random-number.swift
Created May 18, 2017 17:11
Como Generar nīmeros aleatorios en SWIFT
let rand = Int(arc4random_uniform(10)) // numero random en base a 10
let rand2 = Int(arc4random()) // numero random
print("numero1: \(rand), numero2: \(rand2)")
@arbo-hacker
arbo-hacker / string-length.swift
Created May 16, 2017 21:11
Como saber cuantos caracteres tiene un String en SWIFT
var cadena : String = "Cómo saber cuantos caracteres tiene un String en SWIFT"
print(cadena.characters.count)
//Output: 54
@arbo-hacker
arbo-hacker / apache2.conf
Last active October 16, 2016 03:20
Optimización de Apache para Wordpress
Timeout 100
KeepAlive On
MaxKeepAliveRequests 1000
KeepAliveTimeout 5
@arbo-hacker
arbo-hacker / price-events-today.sql
Created October 14, 2016 01:28
Cambios de Precios que se van a ejecutar el día de hoy en RPM
SELECT DECODE (PRICE_EVENT_TYPE,
'PC',
'Cambios de Precio',
'PS',
'Inicio de Promocion',
'PE',
'Fin de Promocion') PRICE_EVENT_TYPE,
DECODE (STATUS,
'N',
'Nuevo / Por Comenzar',
@arbo-hacker
arbo-hacker / gl-accounts-ebs.sql
Last active October 12, 2016 17:09
Obtener desde EBS (GL) los segmentos que están siendo usados para las cuentas contables en Oracle Retail
SELECT st.id_flex_structure_code "Chart of Account Code",
sg.id_flex_num "Chart of Account Num",
sg.segment_name "Segment Name",
sg.application_column_name "Column Name",
sg.flex_value_set_id "Value Set Id",
sg1.application_column_name "Parent Column Name"
FROM apps.fnd_id_flex_structures st
INNER JOIN
apps.fnd_id_flex_segments sg
ON st.application_id = sg.application_id
@arbo-hacker
arbo-hacker / joins-en-oracle.sql
Last active June 10, 2016 03:09
Obtener datos de multiples tablas en Oracle | JOIN
SELECT tabla1.columna, tabla2.columna
FROM tabla1
[NATURAL JOIN tabla2] -- o
[JOIN tabla 2 USING (nombre_columna)] -- o
[JOIN tabla2
ON (tabla1.nombre_columna = tabla2.nombre_columna)] -- o
[LEFT|RIGHT|FULL OUTER JOIN tabla2
ON (tabla1.nombre_columna = tabla2.nombre_columna)] -- o
[CROSS JOIN tabla2];
@arbo-hacker
arbo-hacker / consulta-jerarquica.sql
Last active March 8, 2016 21:48
Consultas Jerárquicas en Oracle | Connect By Prior
SELECT LEVEL, COD_EMPLEADO, CARGO
FROM EMPLEADOS
START WITH COD_EMPLEADO = 1
CONNECT BY REPORTA_A = PRIOR COD_EMPLEADO;
-- OUTPUT:
-- LEVEL COD_EMPLEADO CARGO
-- ----------------- ---------------------- --------------------
-- 1 1 CEO
@arbo-hacker
arbo-hacker / sql-row.sql
Created March 8, 2016 20:34
Clausulas de limitación para ’SQL Row'
create table nums as
select level as num from dual
connect by level <= 100;
-- Table created.
select count(1) as cnt from nums;
-- CNT
-- ------------
@arbo-hacker
arbo-hacker / auto_increment-oracle.sql
Last active February 19, 2016 13:34
Auto_increment en Oracle 12c
CREATE SEQUENCE dept_seq;
CREATE TABLE departments (
ID NUMBER(10) NOT NULL,
DESCRIPTION VARCHAR2(50) NOT NULL);
CREATE OR REPLACE TRIGGER dept_bir
BEFORE INSERT ON departments
FOR EACH ROW