Skip to content

Instantly share code, notes, and snippets.

View ricalamino's full-sized avatar
♦️
Piece of peace

Ricardo Alamino ricalamino

♦️
Piece of peace
View GitHub Profile
@ricalamino
ricalamino / extensions.json
Last active August 13, 2020 16:13
VSCode's Settings - Syncing
[
{
"id": "CoenraadS.bracket-pair-colorizer-2",
"name": "bracket-pair-colorizer-2",
"publisher": "CoenraadS",
"version": "0.2.0"
},
{
"id": "dbaeumer.vscode-eslint",
"name": "vscode-eslint",
@ricalamino
ricalamino / sample.js
Last active August 6, 2018 14:48 — forked from manix/sample.js
Improved "fieldSorter" - usage( arrayOfObjects.sort(fieldSorter(['-price', 'orderId'])); )
function fieldSorterOptimized(fields) {
var dir = [], i, l = fields.length;
fields = fields.map(function(o, i) {
if (o[0] === "-") {
dir[i] = -1;
o = o.substring(1);
} else {
dir[i] = 1;
}
return o;
@ricalamino
ricalamino / keep_utm_queries.php
Created September 17, 2018 17:24
Keep UTM in Wordpress - Put in functions.php
<?php
function add_my_query_var( $link, $query ) {
$utm_source = $_GET['utm_source']; //get sort value
if ( isset($utm_source) ) { //if browsing posts by votes
$link = add_query_arg( 'utm_source', $utm_source, $link );
}
$utm_medium = $_GET['utm_medium']; //get sort value
if ( isset($utm_medium) ) { //if browsing posts by votes
$link = add_query_arg( 'utm_medium', $utm_medium, $link );
@ricalamino
ricalamino / loginNoLock.js
Created October 4, 2018 20:34
Login Without Lock for auth0
public loginNoLock(username: string, password: string): void {
const postData = {
username,
password,
client_id: environment.Auth0.clientID,
connection: 'Username-Password-Authentication',
scope: environment.Auth0.scope
};
const req = this.http.post('https://' + environment.Auth0.domain + '/oauth/ro', postData, {
@ricalamino
ricalamino / signUpNoLock.js
Created October 4, 2018 21:19
Sign Up Without Lock - Auth0
public signUpNoLock(username: string, password: string, name: string) {
const postData = {
client_id: environment.Auth0.clientID,
email: username,
password,
connection: 'Username-Password-Authentication',
user_metadata: { name }
};
const req = this.http.post('https://' + environment.Auth0.domain + '/dbconnections/signup', postData, {
@ricalamino
ricalamino / AjaxContactForm.md
Last active October 5, 2018 18:09 — forked from patotoma/AjaxContactForm.md
Simple Asynchronous Contact Form with jQuery and PHP

Simple Ajax Contact Form with jQuery and PHP

Files:

  • index.html
  • style.css
  • js.js
  • mailer.php

Use:

@ricalamino
ricalamino / auth.component.html
Created October 16, 2018 13:59
Auth0 Auth custom
<input class="sign-up__form-input" type="email" name="email" id="email" placeholder="{{ 'Email' }}"
[(ngModel)]="email" (keyup.enter)="keytab($event)">
<input class="sign-up__form-input" type="password" name="password" id="password" placeholder="{{ 'Password' }}"
[(ngModel)]="password" (keyup.enter)="keytab($event)">
<button >{{ 'ForgotPassword' }}?</button>
<button id="login_submit" class=""
(click)="loginNoLock(email, password)">
{{ 'SignInLogin' }}
</button>
// Portguese(pt) localization of ps.waltheri.net
// Localized name: Portuguese
{
// Top navigation
nav: {
pattern_search: "Busca por padrões",
database: "Navegar no banco de dados",
about: "Sobre",
facebook: "Página do Facebook"
@ricalamino
ricalamino / .htaccess
Last active May 15, 2019 12:51 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@ricalamino
ricalamino / megasena.py
Created May 29, 2019 15:10 — forked from berlotto/megasena.py
Numeros da MegaSena
# -*- encoding: utf-8 -*-
#
# Python Script - Numeros da Megasena
# Faz o download do arquivo da Caixa Economica Federal, com todos os resultados
# da Mega já obtidos. Faz uma contagem simples e mostras, em ordem decrescente,
# a quantidade de vezes que os nros já foram sorteados.
#
# Author: Sergio Berlotto <sergio.berlotto@gmail.com>
# Author website: http://berlotto.github.io
# Licence: GPLv3