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
@carloscabo
carloscabo / archillect_image_urls.txt
Created July 8, 2017 10:09
Archillect.com image urls up to 129530. ( 2017 / 07 / 08 )
This file has been truncated, but you can view the full file.
http://40.media.tumblr.com/8fadd39f4642a3cabc477121b6b09a25/tumblr_n8v66lUHyB1rkla8lo1_1280.png
http://40.media.tumblr.com/32a250ec3347588ece72e5dc9b502c17/tumblr_ngbyyk3EHA1qeyoxro1_500.jpg
http://40.media.tumblr.com/7057c7949bc4b7932d1f3bd5f691a208/tumblr_n789jxJhAA1ttuv5yo1_1280.jpg
http://40.media.tumblr.com/fee70fd43631bad1e662d64ede5da138/tumblr_mxvcdz5N4L1qgiw5to1_1280.jpg
http://41.media.tumblr.com/tumblr_lhbdxmVXGh1qc7ly2o1_500.jpg
http://40.media.tumblr.com/c1ec0e5b8b30bbebb1cbdfdcd7fdcc8c/tumblr_n22v2mH6WH1rvgig6o1_1280.jpg
http://41.media.tumblr.com/tumblr_lvyvhe3bE01qzoj2qo1_1280.png
http://41.media.tumblr.com/3cd42295f6d7310e9c40dcd1ce7680a4/tumblr_mtw27yncgq1rlis9co1_1280.jpg
http://33.media.tumblr.com/41460e0998b603696e7e099cc3a3448a/tumblr_mtbk48fbRb1r70wouo1_500.gif
http://41.media.tumblr.com/tumblr_me9kcaUOV51r3x96uo1_500.jpg
@carloscabo
carloscabo / jquery-data-show.js
Created May 19, 2017 07:11
Toggle visibility os element using data attribute
$(document).on('click', '[data-show]', function(e) {
e.preventDefault();
var
$el = $(this),
// If data-show not empty picks value(s), instead uses href
$target = $(( $el.attr('data-show') !== '' ) ? $el.attr('data-show') : $el.attr('href'));
if ($target.length) {
$target.toggle();
$el.toggleClass('active');
};
@carloscabo
carloscabo / is_ios_safari.js
Created March 28, 2017 13:50
JS Detect Safari on iOS devices
(function(){
var
is_ios = /iP(ad|od|hone)/i.test(window.navigator.userAgent),
is_safari = !!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/);
if ( is_ios && is_safari ) {
var
$html = document.documentElement,
classes = $html.className.concat(' is-ios-safari');
$html.className = classes;
}
@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
@carloscabo
carloscabo / inline-SVGs-in-document-with-JQuery.js
Last active August 14, 2017 12:54
Inlines SVG <IMG> in the HTML document using JQuery
/**
* Inline SVGs in document with JQuery by Carlos Cabo
* https://gist.github.com/carloscabo/8bbc6799434b41d18c1007c45e26c9b6
* Replaces each img with [data-inline-svg] data attribute and svg file extension
* <img src="path/file.svg" data-inline-svg>
* Launch callback function once all the replacements are done
*/
(function() {
var
$svgs = $('[data-inline-svg][src$=".svg"]');
/*
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
@carloscabo
carloscabo / flat-ui-color-palette.scss
Last active February 15, 2016 19:41
Flat UI Color Palette
// Flat UI
$c-aqua: #1abc9c;
$c-aqua-dark: #16a186;
$c-green: #2ecc71;
$c-green-dark: #27ae60;
$c-blue: #3498db;
$c-blue-dark: #2980b9;
$c-purple: #a66abe;
$c-purple-dark: #8e44ad;
$c-yellow: #f1c40f;
@carloscabo
carloscabo / scale-font-size-proportionally-to-screen-size.scss
Created February 11, 2016 14:58
SASS @mixing that scales font size proportionally to screen width, with lower and upper limit...
/*
Scales a font proportionally to the screen size, from -> to
All parameters are pixels, but don't add the 'px' units!
It adds mediaqueries to fix font-size upper and lower limit
@include autoscale-font (
// 320 screen width -> font size 24px
320, 24,
// 1600 screen width -> font size 64px
@carloscabo
carloscabo / getBrowserScrollBarWidth.css
Last active February 10, 2016 16:01
Get Web Browser Scrollbar Width with JQuery
/* CSS for getBrowserScrollBarWidth.js */
.b-s-b-m {
width: 100%;
height: 20px;
position: absolute;
left: 0;
right: 0;
top: 100%;
overflow-y: scroll;
z-index: -1;