Skip to content

Instantly share code, notes, and snippets.

Avatar
🐍

Carlos Andrés Moreno Vélez CarMoreno

🐍
View GitHub Profile
@CarMoreno
CarMoreno / fusion.sql
Last active Nov 19, 2020
Unir tablas PIVOT eliminando duplicados - Bigquery
View fusion.sql
CREATE OR REPLACE TABLE `tabla_c` AS
(
WITH tabla_intermedia AS (
SELECT * FROM `tabla_a` #Tabla Inicial
UNION DISTINCT
SELECT * FROM `tabla_2` #Tabla particionada 2
)
SELECT row[OFFSET(0)].* FROM (
SELECT ARRAY_AGG(t ORDER BY fecha_consulta DESC LIMIT 1) row
View Composicion.py
class PalancaCambio:
# Suponemos que el carro arranca en Neutro (cambio 0 para nosotros)
cambio_actual = 0
def __init__(self, numero_cambios = 4, color='Negro', peso='50gr'):
self.numero_cambios = numero_cambios
self.color = color
self.peso = peso
@CarMoreno
CarMoreno / setup.py
Created Dec 2, 2015
Archivos ejecutables en Python 3.x con cx_Freeze.
View setup.py
import sys
from cx_Freeze import setup, Executable
# base por defecto está para trabajar con apps de consola, en nuestro caso queremos una app gráfica
# si la plataforma es windows, entonces seteamos base a Win32GUI
if sys.platform == "win32":
base = "Win32GUI"
ejecutables = [Executable(
"main.pyw", #El archivo desde donde corre tu aplicacion
View regex.txt
Perl and PHP Regular Expressions
PHP regexes are based on the PCRE (Perl-Compatible Regular Expressions), so any regexp that works for one should be compatible with the other or any other language that makes use of the PCRE format. Here are some commonly needed regular expressions for both PHP and Perl. Each regex will be in string format and will include delimiters.
All Major Credit Cards
This regular expression will validate all major credit cards: American Express (Amex), Discover, Mastercard, and Visa.
//All major credit cards regex
'/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|622((12[6-9]|1[3-9][0-9])|([2-8][0-9][0-9])|(9(([0-1][0-9])|(2[0-5]))))[0-9]{10}|64[4-9][0-9]{13}|65[0-9]{14}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})*$/'
View Simple and Responsive Template..markdown

Simple and Responsive Template.

Responsive and generic template...the goal is strengthen basic concepts about responsive design. :)

A Pen by Carlos Moreno on CodePen.

License.