Skip to content

Instantly share code, notes, and snippets.

View carloscabo's full-sized avatar
🏠
Working 100% remotely since 2018

Carlos Cabo carloscabo

🏠
Working 100% remotely since 2018
View GitHub Profile
@golanlevin
golanlevin / noiseloop.pde
Last active March 7, 2026 21:37
Processing code to demonstrate seamless loop of 1D noise
// Processing 3.0x code to demonstrate seamless loop of 1D noise
// Inspired by, and created in support of:
// "Drawing from noise, and then making animated loopy GIFs from there" by Etienne Jacob (@n_disorder)
// https://necessarydisorder.wordpress.com/2017/11/15/drawing-from-noise-and-then-making-animated-loopy-gifs-from-there/
// Note: this program has no dependencies, and does not require SimplexNoise.
// Demo GIF: https://media.giphy.com/media/xUOxeU2ELSPeTbevle/giphy.gif or http://gph.is/2Ah5kqG
PGraphics offscreenImg;
float myScale = 0.01;
float radius = 100.0;
@carloscabo
carloscabo / mean_of_angles.php
Last active July 27, 2019 17:16
Calculate the mean / average of a set of angles in radians / degrees
<?php
/*
From: https://en.wikipedia.org/wiki/Mean_of_circular_quantities
Parameters:
$angles: array
$degrees: boolean. Angles and result in degrees (default)
*/
function mean_of_angles( $angles, $degrees = true ) {
if ( $degrees ) {
$angles = array_map("deg2rad", $angles); // Convert to radians
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console]
"ColorTable00"=dword:00000000
"ColorTable01"=dword:00800000
"ColorTable02"=dword:00008000
"ColorTable03"=dword:00808000
"ColorTable04"=dword:00000080
"ColorTable05"=dword:00800080
"ColorTable06"=dword:00008080
/*
Add / remove prefixes to DOM element classes. Requieres JQuery.
https://gist.github.com/carloscabo/e0374676c614dd6e6ea19ad4b9ecf9a4
by Carlos Cabo 2016. MIT License.
How it works:
1. Loops over the group of elements
2. For each element if it has any class that matches the regex:
a. If the prefix is NOT present -> adds
b. If the prefix IS present -> removes
@pawelszydlo
pawelszydlo / transmission_remove_finished.sh
Last active June 10, 2024 14:37
Script to clear finished torrents from transmission-daemon
#!/bin/bash
# Clears finished downloads from Transmission.
# Version: 1.1
#
# Newest version can always be found at:
# https://gist.github.com/pawelszydlo/e2e1fc424f2c9d306f3a
#
# Server string is resolved in this order:
# 1. TRANSMISSION_SERVER environment variable
@odan
odan / xampp_php7_xdebug.md
Last active August 9, 2026 05:06
Installing Xdebug for XAMPP
// //placehold.it
function randomColorPit( w, h, number, format ) {
var
u = '//placehold.it/'+w+'x'+h+'/{{__c__}}.'+( format ? format : 'jpg' ),
n = number || 1,
r = [];
for (var i = 0; i < n; i++) {
r.push(u.replace('{{__c__}}', (Math.random().toString(16) + '0000000').slice(2, 8)));
}
console.log(r.join("\n"));
root = "/fullpath/your_project/current"
working_directory root
pid "#{root}/tmp/pids/unicorn.pid"
stderr_path "#{root}/log/unicorn.error.log"
stdout_path "#{root}/log/unicorn.log"
listen 8080
worker_processes 2
timeout 30
@carloscabo
carloscabo / flexslider_destroy.js
Created September 28, 2015 14:50
Destroy flexslider carousel
function flexdestroy(selector) {
var $els = $(selector);
$els.each(function() {
var $el = $(this);
var $elClean = $el.clone();
$elClean.find('.flex-viewport').children().unwrap();
$elClean
@atelierbram
atelierbram / reset.css
Last active October 20, 2023 06:42 — forked from iegik/reset.css
CSS Typography reset
html, body, div, span, applet, object, iframe, table, caption,
tbody, tfoot, thead, tr, th, td, del, dfn, em, font, img, ins,
kbd, q, s, samp, small, strike, strong, sub, sup, tt, var,
h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr,
acronym, address, big, cite, code, dl, dt, dd, ol, ul, li,
fieldset, form, label, legend {
vertical-align: baseline;
font-family: inherit;
font-weight: inherit;
font-style: inherit;