Skip to content

Instantly share code, notes, and snippets.

View camaleaun's full-sized avatar

Gilberto Tavares camaleaun

  • Yogh
  • Joinville SC, Brazil
  • 01:19 (UTC -03:00)
View GitHub Profile
@camaleaun
camaleaun / functions.php
Created March 24, 2017 15:48
Remove USC Attempts
add_filter( 'wpmdb_rows_sql', 'remove_usc_attempts', 10, 2 );
function remove_usc_attempts( $sql, $table ) {
global $wpdb;
if ( $table === $wpdb->options ) {
$sql = str_replace( 'ORDER BY', "`option_name` NOT 'wp_ultimate_security_checker_failed_login_attempts_log' ORDER BY", $sql );
}
return $sql;
}
@camaleaun
camaleaun / mapa-shortcode.php
Last active May 5, 2017 00:02
WP Short Code to Google Maps JS API Embed
<?php
if ( ! class_exists( 'Mapa_Shortcode' ) ) :
/**
* Shortcode [mapa]
*
* Pega atributos através do place="lat,lng"
*
* Ex.: [mapa place="-26.2458151,-49.3858951"]
* Mostra o script e: <div id="map" class="map"></div>
@camaleaun
camaleaun / wordpress-firebase.php
Created May 17, 2017 18:59 — forked from derekconjar/wordpress-firebase.php
An example of using Firebase and WordPress together. The idea is to use WP's custom post types and metaboxes to make content management easy, and sync with Firebase so that your websites have access to a real-time JSON feed of your custom data.
<?php
/**
* All custom functions should be defined in this class
* and tied to WP hooks/filters w/in the constructor method
*/
class Custom_Functions {
// Custom metaboxes and fields configuration
@camaleaun
camaleaun / pascoal.ual
Created May 18, 2017 02:26
Algoritmo obter dia da Páscoa
prog pascoa
int dia, mes, ano, a, b, c, d, e, f, g, h, i, k, l, m;
imprima "Digite ano: ";
leia ano;
a <- ano%19;
b <- ano div 100;
c <- ano%100;
d <- b div 4;
e <- b%4;
f <- (b + 8) div 25;
@camaleaun
camaleaun / carnaval.ual
Created May 18, 2017 02:28
Algoritmo para obter dia do Carnaval
prog carnaval
int dia, mes, ano, a, b, c, d, e, f, g, h, i, k, l, m, x, dias;
logico bissexto;
bissexto <- falso;
imprima "Digite ano: ";
leia ano;
se ( ano%400 == 0 || (ano%4 == 0 && ano%100 <> 0) ) {
bissexto <- verdadeiro;
}
a <- ano%19;
@camaleaun
camaleaun / carnaval.ual
Created May 18, 2017 02:28
Algoritmo para obter dia do Carnaval
prog carnaval
int dia, mes, ano, a, b, c, d, e, f, g, h, i, k, l, m, x, dias;
logico bissexto;
bissexto <- falso;
imprima "Digite ano: ";
leia ano;
se ( ano%400 == 0 || (ano%4 == 0 && ano%100 <> 0) ) {
bissexto <- verdadeiro;
}
a <- ano%19;
@camaleaun
camaleaun / horarioverao.ual
Created May 18, 2017 02:29
Algoritmo para obter início e fim do Horário de Verão
prog horarioverao
int inicio, fim, ano, s, dia, mes, a, b, c, d, e, f, g, h, i, k, l, m, x, dias;
logico bissexto;
bissexto <- falso;
imprima "Digite ano: ";
leia ano;
s <- ((ano - 1901) * 365 + (ano - 1901) div 4 + 274 + ((4 - ano % 4) div 4)) % 7;
inicio <- 21-s;
s <- ((ano - 1900) * 365 + (ano - 1900) div 4 + 32) % 7;
fim <- 21-s;
@camaleaun
camaleaun / bulkrename.sh
Created November 7, 2017 15:12
Rename images without spaces and special characteres for import
#!/bin/bash
slug() {
slug="$1"
slug=${slug,,}
slug=${slug// /_}
slug=${slug//ó/o}
slug=${slug//ô/o}
slug=${slug//é/e}
slug=${slug//ú/u}
@camaleaun
camaleaun / weathersbs.sh
Last active November 7, 2017 15:38
Get temperatures from company of water service in São Bento do Sul SC - Brazil
#!/bin/bash
echo 'Temperatures in São Bento do Sul SC - Brazil'
CURL=$(curl -s http://www.samaesbs.sc.gov.br/)
NOW=$(echo $CURL | grep -oP 'temperatura\">\K([\d.]+)')
HIGH=$(echo $CURL | grep -oP '_max\">\K([\d.]+)')
LOW=$(echo $CURL | grep -oP '_min\">\K([\d.]+)')
echo " Now $NOWºC"
@camaleaun
camaleaun / Requirements.php
Last active November 17, 2017 00:16
Interface HTML by PHP to show info from endpoint JSON API
<?php
declare(strict_types=1);
/**
* Interface to JSON endpoint.
*/
namespace GilbertoTavares;
/**
* Class to GET JSON and print.