Skip to content

Instantly share code, notes, and snippets.

View JulienCabanes's full-sized avatar

Julien Cabanès JulienCabanes

View GitHub Profile
@cvan
cvan / webgl-detect-gpu.js
Last active January 19, 2024 02:54
use JavaScript to detect GPU used from within your browser
var canvas = document.createElement('canvas');
var gl;
var debugInfo;
var vendor;
var renderer;
try {
gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
} catch (e) {
}
@bowheart
bowheart / Sasser.php
Created November 8, 2016 15:44
A few sass-style functions for color manipulation in php
<?php
class Sasser {
private $hexChars = array('a' => 10, 'b' => 11, 'c' => 12, 'd' => 13, 'e' => 14, 'f' => 15);
public function toRGB($hex) {
if (is_array($hex)) return $hex;
if (substr($hex, 0, 1) === '#') $hex = substr($hex, 1);
if (strlen($hex) === 3) $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
@psebborn
psebborn / countCSSRules.js
Last active April 25, 2023 11:43
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {