Skip to content

Instantly share code, notes, and snippets.

View babelpuntocl's full-sized avatar
🤖

babel.cl babelpuntocl

🤖
View GitHub Profile
@keijiro
keijiro / 00_blot8.md
Last active June 4, 2022 13:05
KodeLife fragment shader sketch

gif

@nataliefreed
nataliefreed / randomColorFromArray.js
Created September 28, 2016 20:46
Pick a random color from an array in P5
function setup() {
createCanvas(600, 600);
var listOfColors = [color('#aabf12'), color('#33ab12'), color('#165512'), color('#fe3fa2'), color('#a345cd')];
var stripeWidth = 20;
strokeWeight(stripeWidth);
for(var i=0;i<=width/stripeWidth;i++) {
stroke(listOfColors[int(random(0, listOfColors.length))]);
@babelpuntocl
babelpuntocl / excerpts.php
Created April 22, 2014 14:23
Excerpts personalizados
function excerpt($limit) { $excerpt = explode(' ', get_the_excerpt(), $limit); if (count($excerpt)>=$limit) { array_pop($excerpt); $excerpt = implode(" ",$excerpt).'...'; } else { $excerpt = implode(" ",$excerpt); } $excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt); return $excerpt; } function content($limit) { $content = explode(' ', get_the_content(), $limit); if (count($content)>=$limit) { array_pop($content); $content = implode(" ",$content).'...'; } else { $content = implode(" ",$content); } $content = preg_replace('/\[.+\]/','', $content); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]&gt;', $content); return $content; }
<?php echo excerpt(25); ?>
@jurandysoares
jurandysoares / christmastree.py
Created December 26, 2012 15:04
A small Christmas' Tree Algorithm in Python.
import turtle
screen = turtle.Screen()
screen.setup(800,600)
circle = turtle.Turtle()
circle.shape('circle')
circle.color('red')
circle.speed('fastest')
circle.up()
@mikejolley
mikejolley / gist:1751128
Last active September 19, 2024 12:40
WooCommerce - Hide loop buttons for out of stock items
/*
* Override via functions.php
**/
if (!function_exists('woocommerce_template_loop_add_to_cart')) {
function woocommerce_template_loop_add_to_cart() {
global $product;
if ( ! $product->is_in_stock() || ! $product->is_purchasable() ) return;
woocommerce_get_template('loop/add-to-cart.php');
}
}