Skip to content

Instantly share code, notes, and snippets.

@spin0us
spin0us / details-summary-display-hack.md
Last active July 28, 2023 08:42
Details html element hack to overcome the impossibility to change its display style

I was trying to apply a display:grid on a details element for a project, but it fails. After some search, it's seems to be impossible to change the display style of this element. Only solution is to simulate this element with new custom element and some javascript. Here is the result.

Here is the CSS part

custom-details > custom-summary {
    cursor: pointer;
    display: list-item;
    list-style-position: inside;
 list-style-type: disclosure-closed;
@spin0us
spin0us / lib.combobox.js
Last active April 1, 2022 15:10
A pure JavaScript combobox
/*!
* A pure JavaScript combobox v1.3
* https://gist.github.com/spin0us/fb81680d5761bfb810446005b2fe6e6c
*
* Author: Spin0us
*
* Date: 2022-04-01
*/
'use strict';
document.querySelectorAll('select[data-search="true"]').forEach(elm => {
@spin0us
spin0us / lib.modal.js
Last active March 30, 2022 17:10
_prompt - A pure JavaScript prompt modal
/*!
* _prompt - A pure JavaScript prompt modal v1.0
* https://gist.github.com/spin0us/0fbfe6b0d2cca8a0efca2b67c14b3876
*
* Author: Spin0us
*
* Date: 2022-03-30
*/
'use strict';
const _prompt = function(args){
// init multi handler
$multihandler = curl_multi_init();
$handlers = $result = array();
...
// init each url
foreach ($urls as $i) {
$handlers[$i] = curl_init($i);
curl_setopt($handlers[$i], CURLOPT_RETURNTRANSFER, TRUE);
@spin0us
spin0us / gist:11376298
Created April 28, 2014 15:58
mMySQL : Convert all table from MyISAM to InnoDB
SELECT CONCAT('ALTER TABLE ',table_schema,'.',table_name,' ENGINE=InnoDB;')
FROM information_schema.tables
WHERE table_schema NOT IN ('mysql','test','performance_schema','information_schema')
AND ENGINE='MyISAM'
@spin0us
spin0us / gist:5583418
Created May 15, 2013 11:47
Check if date (english datetime or unix timestamp) is a french holiday
if(!function_exists('isFrenchHoliday'))
{
function isFrenchHoliday($str)
{
$ts = (preg_match('/^[0-9]{10}$/', $str)) ? $str : strtotime($str);
$date = date("md", $ts);
if($date == '0101') return true; // 1er janvier
if($date == '0501') return true; // 1er mai
if($date == '0508') return true; // 8 mai
if($date == '0714') return true; // 14 juillet
@spin0us
spin0us / gist:5500741
Created May 2, 2013 07:43
Ubuntu : clean /boot
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
@spin0us
spin0us / gist:5413229
Created April 18, 2013 14:37
Display all errors
error_reporting(E_ALL);
ini_set('display_errors', '1');
@spin0us
spin0us / gist:5261580
Created March 28, 2013 08:23
Unable to install Linux Mint 14 on some AMD processor : ubiquity crash
Boot from live CD
Start Terminal
sudo apt-get purge ubiquity-slideshow-mint
Close Terminal
Start installation process
@spin0us
spin0us / gist:5254193
Last active December 15, 2015 11:39
Server tips to install new gcc from sources and use it
### Install new version of gcc
tar xzf gcc-4.6.2.tar.gz
cd gcc-4.6.2
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-4.6.2/configure --prefix=/opt/gcc-4.6.2
make