Skip to content

Instantly share code, notes, and snippets.

View lenivene's full-sized avatar
🖖
Full-stack dev

Lenivene Bezerra lenivene

🖖
Full-stack dev
View GitHub Profile
@lenivene
lenivene / No iframe.js
Created November 9, 2015 03:58
Redirect if in iframe switched on
if((self.parent && !(self.parent===self)) || (self.parent.frames.length!=0) || (parent.frames.length > 0) || ( window!= window.top )){self.parent.location=document.location;}
@lenivene
lenivene / ajax.php
Last active April 6, 2021 02:32
Get the song name in Shoutcast! Tested code in the "Rádio Vibe Sertaneja"
<?php
/*
* Name: Song name in ShoutCast
* Version: 1.16.10.15.0
* Description: Get the song name in Shoutcast, example of use ( ajax.php?domain='Your IP or domain name'&port='Number port' );
* Author: Lenivene Bezera
* Licence: MPL
*/
$ip = ( isset($_GET['domain']) && !empty($_GET['domain']) ) ? $_GET['domain'] : '69.46.88.19';
$port = ( isset($_GET['port']) && !empty($_GET['port']) ) ? $_GET['port'] : '80';
@lenivene
lenivene / wesley_safadao.php
Last active January 2, 2016 20:18
Safadômetro por Jefferson de Carvalho
<?php
/**
* Somatório da função "wesley_safadao"
* @param {number} $num [Numero máximo a ser somado]
* @return {number} [Numero somado]
*/
function somatorio( $num ){
$somatorio = 0;
for($valor = 1; $valor <= $num; $valor++){
$somatorio += $valor;
@lenivene
lenivene / .htaccess
Last active February 8, 2016 14:20
Force loading with the WWW ( htaccess, php, nginx and web.config )
RewriteEngine On
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
@lenivene
lenivene / functions.php
Created February 4, 2016 13:59
Remove multiple spaces and filter in the_content and the_excerpt || get_the_excerpt.
<?php
/*
* Filter in functions 'the_content' and 'the_excerpt'
*/
add_filter( 'get_the_excerpt', 'esc_spaces' );
// add_filter( 'the_excerpt', 'esc_spaces' ); // Don't required
add_filter( 'the_content', 'esc_spaces' );
function esc_spaces( $content ){
if ( '' == $content )
return $content;
@lenivene
lenivene / insert-likes-custom-field.php
Last active February 8, 2016 14:22 — forked from rhcarlosweb/add-info-facebook-to-custom-field-wordpress.php
Adiciona informações do facebook a campos personalizados WordPress
<?php
/**
* Author: Rhuan Carlos
*/
function insert_likes_custom_field( $post_ID ) {
global $wpdb;
if ( !wp_is_post_revision( $post_ID ) ){
add_post_meta( $post_ID, 'likes_count', '0', true );
}
@lenivene
lenivene / functions.php
Last active February 26, 2016 06:09
get_the_excerpt by ID post
<?php
/**
* Filter from "the_excerpt".
*
* @since 1.0.0
* @param string $post_excerpt The post excerpt.
*
*/
function get_excerpt_by_ID( $post = 0){
$post = get_post( $post );
@lenivene
lenivene / is_num_negative.php
Last active March 1, 2016 20:48
Check if number is positive | negative
<?php
/*
* Check number is positive
* PHP Version required >= 4.0
*/
function is_num_negative( $num ){
if( empty( trim( $num ) ) || ! is_numeric( $num ) ){
return;
}
/*
@lenivene
lenivene / functions.php
Last active May 23, 2016 12:29
Disable WordPress Responsive Images
<?php
/**
* Disable WordPress Responsive Images
*/
add_filter( 'wp_calculate_image_srcset', '__return_false' );
@lenivene
lenivene / api.vagalume.config.js
Last active February 13, 2023 10:42
Aqui exibe os resultados ;)
if(window.jQuery)
$(document).ready(function(){
/**
* More informations
* URI: http://api.vagalume.com.br/docs/radios/
*/
var radio = "coca-cola-fm", // Your webradio here
api_key = ""; // Get key here http://auth.vagalume.com.br/settings/api/
if(typeof "undefined" != radio