Skip to content

Instantly share code, notes, and snippets.

View marcosfreitas's full-sized avatar
🔥
Looking forward

Marcos Freitas marcosfreitas

🔥
Looking forward
View GitHub Profile
@marcosfreitas
marcosfreitas / search.html
Last active May 20, 2019 15:10
Autocomplete Search With Semantic UI
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Autocomplete Search With Semantic UI</title>
<link rel="stylesheet" href="semantic/dist/semantic.css">
</head>
<body>
@marcosfreitas
marcosfreitas / check_if_has_a_string_in_array.asp
Last active August 29, 2015 14:18 — forked from gwobcke/checkIfInArray.asp
Esta função em ASP serve para verificar se um determinado valog existe em um array. Retorna false se não encontrar nada ou retorna a posição (i) onde o valor foi encontrado
<%
Function inArray(byVal value, byVal my_array)
Dim i
inArray = false
For i=0 To Ubound(my_array)
If (my_array(i) = value) Then
inArray = true
Exit Function
End If
@marcosfreitas
marcosfreitas / functions.php
Created March 10, 2015 02:57
Registering Taxonomies and Post_type - WordPress
// Register Custom Post Type
function c4n_new_post_type() {
$labels = array(
'name' => _x( 'Journals', 'Post Type General Name', 'turing_press' ),
'singular_name' => _x( 'Journal', 'Post Type Singular Name', 'turing_press' ),
'menu_name' => __( 'Journals', 'turing_press' ),
'parent_item_colon' => __( 'Parent Journal:', 'turing_press' ),
'all_items' => __( 'All Journals', 'turing_press' ),
'view_item' => __( 'View Journal', 'turing_press' ),
@marcosfreitas
marcosfreitas / multiple-modals-semantic.html
Created March 9, 2015 08:09
Creating Multiple Modals in Semantic UI :)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Multiple Modals With Semantic UI</title>
<link rel="stylesheet" href="path_to_semantic/dist/semantic.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="path_to_semantic/dist/semantic.js"></script>
</head>
<body>
@marcosfreitas
marcosfreitas / function.php
Created January 8, 2015 15:49
Woocommerce Shipping - Hide standard Shipping Methods when free (local delivery) is available
/* Woocommerce Shipping */
// Hide standard shipping when free is available
// Original script https://gist.github.com/pauloiankoski/9707209
add_filter( 'woocommerce_available_shipping_methods', 'mf_hide_standard_shipping_when_free_is_available' , 10, 1 );
function mf_hide_standard_shipping_when_free_is_available( $available_methods ) {
global $woocommerce;
// First the free shipping method is only available to local delivery
@marcosfreitas
marcosfreitas / get_categories.php
Last active November 10, 2015 20:04
WORDPRESS: Retrieve children of a parent category - get_categories()
<?php
/* Subcategories of "Journals" (id: 6) */
$categories = get_categories('child_of=6&hide_empty=0');
foreach ($categories as $cat):
/* This get the total of posts in current category of the loop.*/
$total_of_posts_in_category = (int) $cat->count;
$current_category_name = $cat->name;
/* For each category, make the loop for the amount of posts */
@marcosfreitas
marcosfreitas / jck-woothumbs-fix.js
Last active August 29, 2015 14:07
JCK WOOTHUMBS 4.0.0 - Manual Fix for Maximum call stack size exceeded error. If you have the license for the suport, don't do this, upgrade your version. But you don't have... :)
/* @author: Marcos Freitas */
/*
* Into function triggerSlider() replace the call for the function triggerEffects()
*/
// passing the limite of recursive executions
triggerEffects(10);
/*
@marcosfreitas
marcosfreitas / woocommerce-categories-list.php
Created August 13, 2014 15:08
Pega a lista de categorias do woocommerce de acordo com os parâmetros repassados na página de uma determinada categoria e forma um dropdown
/**
* Dropdown de categorias para design responsivo
* Pegando as categorias dos produtos de acordo com os argumentos passados
*/
$args = array( 'number' => $number, 'orderby' => $orderby, 'order' => $order, 'hide_empty' => true, 'include' => $ids );
$product_categories = get_terms( 'product_cat', $args );
?>
<ul id="list-widget-responsive">
<li id="" class="widget widget-responsive woocommerce widget_product_categories">
/* ==========================================================================
Buttons Class Configurations
========================================================================== */
/*
* Redefinition to bootstrap buttons
*/
.btn, .btn[disabled], .btn:focus, .btn:hover, .btn:active{
color: #333;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
@marcosfreitas
marcosfreitas / pega-img-string.php
Created July 17, 2014 16:56
Maneira para obter a tag img de uma string com php
<?php
/*É preciso tratar a string da descrição do câmbio pq o html vem sujo com IDs duplicados*/
$item['n_content'] = trim((string) $attr->description);
/*
exemplo de conteúdo:
<img src='http://imguol.com/c/noticias/2014/07/17/17jul2014---um-aviao-de-passageiros-da-malaysia-airlines-com-295-pessoas-bordo-caiu-na-ucrania-na-regiao-de-fronteira-com-a-russia-de-acordo-com-informacoes-da-agencia-russa-de-noticias-interfax-1405612628026_142x100.jpg' align="left" />
Veja o Álbum de fotos
*/