Skip to content

Instantly share code, notes, and snippets.

Diogo Machado diogoalexsmachado

Block or report user

Report or block diogoalexsmachado

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:0cfd20374779b50384d4a3b7dfc68298
// validação email com mais segurança
$.validator.addMethod("completeemail",
function(value, element) {
return /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(value);
},
"O endereço e-mail não é válido"
);
@diogoalexsmachado
diogoalexsmachado / matrix.sh
Created Dec 19, 2018
useless but funny :)
View matrix.sh
#!/bin/bash
#
# matrix: matrix-ish display for Bash terminal
# Author: Brett Terpstra 2012 <http://brettterpstra.com>
# Contributors: Lauri Ranta and Carl <http://blog.carlsensei.com/>
#
# A morning project. Could have been better, but I'm learning when to stop.
### Customization:
blue="\033[0;34m"
View unsaved work check - js
# No inicio.jsp
<input type="hidden" id="controloAlteracoes" value="0">
# no acesso.js (chamado no inicio.jsp)
$("#controloAlteracoes").change(function () {
if ($(this).val() == 1) {
toastr.clear();
toastr["info"]("Existem informações não guardadas", "Atenção", {
"closeButton": true,
"debug": false,
View grapesjs.sh
#!/bin/bash
git clone https://github.com/artf/grapesjs-preset-webpage.git && cd grapesjs-preset-webpage
npm i
npm i grapesjs --no-save
npm start
View Validação NISS .JS
function validarNISS() {
var niss = $("#inputNISS").val();
//deve ter 11 dígitos
if(niss.length != 11) {
swal("Aviso", "O número de Segurança Social deverá ter 11 dígitos.", "warning");
} else {
var FACTORS = [29, 23, 19, 17, 13, 11, 7, 5, 3, 2];
var nissArray = [];
for (var i = 0; i < niss.length; i++) {
View BI - CC Validation .JS
/*******************************************
* STRING RELATED FUNCTIONS *
* FROM http://stackoverflow.com/a/1144788 *
*******************************************/
function escapeRegExp(string) {
return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
}
function replaceAll(find, replace, str) {
View Validação NISS PT Java
public class NISSValidator {
private NISSValidator() {
}
/**
* Validates if a given string niss is valid.
*
* @param niss number to validate
* @return true if the input is valid and false otherwise
@diogoalexsmachado
diogoalexsmachado / instructions.md
Created Jun 9, 2018 — forked from susanBuck/instructions.md
How to reset `root` password in XAMPP MySQL
View instructions.md

Open C:\xampp\mysql\bin\my.ini (MySQL config file)

Find the line [mysqld] and right below it add skip-grant-tables

2017-11-20_1822

This should allow you to access MySQL if you don't know your password.

Stop and start MySQL from XAMPP to make this change take effect.

View windows 10 mining tweaks
@ECHO OFF
COLOR 1F
SET V=1.7
TITLE Windows 10 Registry tweaks for mining (x64) by: jsanzsp
REM ======================= Registry tweaks =======================
ECHO.
:regstart
set /p registry="Apply Registry tweaks? y/n: "
if '%registry%' == 'n' goto servstart
if /i "%registry%" neq "y" goto regstart
View makewise_v2
package com.teste.app;
public class Main {
public static void main(String[] args) {
int[][] nums = {{ 1, 2, 3, 4},
{ 5, 6, 7, 8},
{ 9, 10, 11, 12},
{13, 14, 15, 16}};
You can’t perform that action at this time.