Skip to content

Instantly share code, notes, and snippets.

View ctwhome's full-sized avatar
🌍

Jes Gonzalez ctwhome

🌍
View GitHub Profile
@ctwhome
ctwhome / typeof.js
Created September 13, 2014 19:01
Lybrary to check if the type of and format of the variables
//Created by Carlos (Coders.me)
//http://www.coders.me/web-html-js-css/javascript/libreria-de-validaciones-simples
function _IsInteger(str) { if (typeof(str)=='undefined') { return false; } var expr = /^[+-]?[0-9]*$/; if (!expr.test(str)) return false; return true; }
function _IsNumber(str) { if (typeof(str)=='undefined') { return false; } var expr1 = /^[+-]?[0-9]+(.[0-9]{0,})?$/; var expr2 = /^[+-]?(.[0-9]{0,})?$/; if (!expr1.test(str)){ if (!expr2.test(str)){ return false; } } return true; }
function _IsMoney(str) { if (typeof(str)=='undefined') { return false; } var expr1 = /(?!^0*$)(?!^0*.0*$)^d{1,10}(.d{1,2})?$/; if (!expr1.test(str)){ return false; } return true; }
function _ValInMinMax(value,min,max) { if (!(_IsNumber(value))) { return false; } if ((!(_IsNumber(min))) || (!(_IsNumber(max)))) { return false; } if ((typeof(min)!='undefined') || (typeof(max)!='undefined')) { if ((typeof(min)!='undefined') && (typeof(max)!='undefined')) { if ((!isNaN(min)) && (!isNaN(max))) if (min>max) return false; }
@ctwhome
ctwhome / component.js
Created October 21, 2017 15:02 — forked from efernandesng/component.js
react-intl injectIntl decorator
import React, {Component, PropTypes} from 'react';
import {intlShape} from 'react-intl';
import {injectIntl} from './decorator';
@injectIntl()
class Xpto extends Component {
static propTypes = {
intl: intlShape.isRequired
};
@ctwhome
ctwhome / package.json
Created January 25, 2019 09:20
Watch for changes in Local Typescript Firebase functions
{
"name": "functions",
"scripts": {
"lint": "tslint --project tsconfig.json",
"build": "tsc",
"build-watch": "tsc -w",
"serve": "concurrently \"firebase serve --only functions\" \"npm run build-watch\"",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
@ctwhome
ctwhome / Dockerfile
Last active April 21, 2020 07:52 — forked from RinatMullayanov/Dockerfile
Ubuntu Node.js Dockerfile
#
# Ubuntu Node.js Git Dockerfile
#
# https://github.com/dockerfile/ubuntu/blob/master/Dockerfile
# https://docs.docker.com/examples/nodejs_web_app/
#
# Pull base image.
FROM ubuntu
/**
* Vue component with Vuetify
* Read recursively all files and folders inside a choosen directory
*/
<template>
<v-card class="pa-4" outlined>
<div class="d-flex">
<v-btn
depressed
:color="isTreeEmpty ? 'default' : 'primary'"
#
# Ubuntu Node.js Git Dockerfile
#
# https://github.com/dockerfile/ubuntu/blob/master/Dockerfile
# https://docs.docker.com/examples/nodejs_web_app/
#
# Pull base image.
FROM ubuntu
@ctwhome
ctwhome / 1M random numbers. Sql
Created April 11, 2021 18:55
Create 1M random numbers
-- create a million random numbers and strings
CREATE TABLE items AS
SELECT
(random()*1000000)::integer AS n,
md5(random()::text) AS s