Skip to content

Instantly share code, notes, and snippets.

View HenriqueSilverio's full-sized avatar
🎯
Focusing

Henrique Silvério HenriqueSilverio

🎯
Focusing
View GitHub Profile
@Bobz-zg
Bobz-zg / functions.php
Last active January 17, 2023 20:30
Filter WordPress posts by custom taxonomy term with AJAX
<?php
/**
* AJAC filter posts by taxonomy term
*/
function vb_filter_posts() {
if( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'bobz' ) )
die('Permission denied');
/**
@corysimmons
corysimmons / package.json
Created June 23, 2016 21:07
babel, sass, npm-run-all
{
"devDependencies": {
"babel-cli": "^6.10.1",
"babel-preset-es2015": "^6.9.0",
"babel-preset-stage-0": "^6.5.0",
"node-sass": "^3.8.0",
"npm-run-all": "^2.2.2"
},
"babel": {
"presets": [
function telefone_validation(telefone) {
//retira todos os caracteres menos os numeros
telefone = telefone.replace(/\D/g, '');
//verifica se tem a qtde de numero correto
if (!(telefone.length >= 10 && telefone.length <= 11)) return false;
//Se tiver 11 caracteres, verificar se começa com 9 o celular
if (telefone.length == 11 && parseInt(telefone.substring(2, 3)) != 9) return false;
@santoshachari
santoshachari / Laravel PHP7 LEMP AWS.md
Last active February 20, 2024 10:00
Laravel 5.x on Ubuntu 16.x, PHP 7.x, Nginx 1.9.x

#Steps to install latest Laravel, LEMP on AWS Ubuntu 16.4 version. This tutorial is the improvised verision of this tutorial on Digitalocean based on my experience.

Install PHP 7 on Ubuntu

Run the following commands in sequence.

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install zip unzip
@subfuzion
subfuzion / curl.md
Last active May 16, 2024 18:04
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@jarkkolaine
jarkkolaine / authenticate_with_email.php
Created September 18, 2015 11:58
A simple code snippet for authenticating a user using email address
public function authenticate_with_email( $user, $email, $password ) {
if ( is_wp_error( $user ) ) {
// Already failed
return $user;
}
if( empty( $email ) || empty ( $password ) ) {
$error = new WP_Error();
if ( empty( $email ) ) {
$error->add( 'empty_username', __( '<strong>ERROR</strong>: Email field is empty.' ) );

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
@ourmaninamsterdam
ourmaninamsterdam / LICENSE
Last active April 24, 2024 18:56
Arrayzing - The JavaScript array cheatsheet
The MIT License (MIT)
Copyright (c) 2015 Justin Perry
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@derhansen
derhansen / removeJobsRedisDriver.php
Last active November 10, 2022 17:17
Laravel 5 - remove all jobs from a queue (redis driver)
Redis::connection()->del('queues:myqueue');
var Backboneiros = Backbone.Collection.extend({
rearrange: function (atIndex, toIndex) {
var modelMemory = this.models[atIndex];
this.remove(modelMemory, { silent: true });
this.add(modelMemory, { at: toIndex });
}
});
module.exports = Backboneiros;