Skip to content

Instantly share code, notes, and snippets.

@mistic100
mistic100 / tumblr-downloader.js
Last active April 24, 2022 19:49
[Node] Simple Tumblr photo downloader for NodeJS. Really basic, no options, no error handling.
/**
* TUMBLR downloader
*
* Usage:
* - enter the blog name: URL part before `.tumblr.com`
* - enter what you want to download: `posts` or `likes`
* - enter your OAuth public key (https://www.tumblr.com/settings/apps)
* - optionally enter the minimum id to retrieve (ignored if `[blog]-[mode].last` file exists)
* - if you have a small internet connection, set the queue size to 1
* - you can ask the downloader to overwrite existing files
@mistic100
mistic100 / imageroundedrectangle.php
Last active October 27, 2021 08:47
[PHP] Draw a rectangle with rounded corners
<?php
/**
* Draw a rectangle with rounded corners.
* @param ressource &$img An image resource
* @param int $x1 Upper left x coordinate
* @param int $y1 Upper left y coordinate
* @param int $x2 Bottom right x coordinate
* @param int $y2 Bottom right y coordinate
* @param int $r Corners radius
* @param int $color A color identifier created with imagecolorallocate()
@mistic100
mistic100 / 1.phugo-gallery-generator.md
Last active May 1, 2021 09:17
Gallery generator for Phugo
______________________________
/ __________________________ /|
/ / ________________________/ / |
/ / /| | / / |
/ / / | | / / . |
/ / /| | | / / /| |
/ / / | | | / / / | |
/ / / | | | / / /| | |
/ /_/___| | |_______________/ / / | | |
/________| | |________________/ / | | |
@mistic100
mistic100 / dir_is_empty.php
Last active January 7, 2021 14:33
[PHP] Check if a folder is empty
<?php
/**
* Check if a directory is empty (a directory with just '.svn' or '.git' is empty)
*
* @param string $dirname
* @return bool
*/
function dir_is_empty($dirname)
{
if (!is_dir($dirname)) return false;
@mistic100
mistic100 / jQuery.textareaLinesNumbers.css
Created April 8, 2015 18:20
Adds line numbers to <textarea>
.textareaLinesNumbers {
position: relative;
}
.textareaLinesNumbers textarea.linesContainer {
display:block;
border:none;
position:absolute;
overflow:hidden;
text-align:right;
@mistic100
mistic100 / array_unique_deep.php
Last active January 25, 2020 12:14
[PHP] Extract unique values of the specified key in a two dimensional array
<?php
/**
* Extract unique values of the specified key in a two dimensional array
*
* @param array $array
* @param mixed $key
* @return array
*/
function array_unique_deep($array, $key)
{
@mistic100
mistic100 / TreeBuilder.php
Last active August 20, 2019 14:51
[PHP] Recursive builder pattern
<?php
/**
* Recursive builder pattern
*
* Usage:
* $tree = \Tree\Builder::init()
* ->setName('parent')
* ->addChild()
@mistic100
mistic100 / qboutongroupext.hpp
Created January 10, 2016 12:16
[Qt/C++] QButtonGroup which allow to set the checked radio button by its id
#ifndef QBUTTONGROUPEXT
#define QBUTTONGROUPEXT
#include <QButtonGroup>
#include <QAbstractButton>
/**
* @brief QButtonGroup which allow to set the checked radio button by its id
*/
class QButtonGroupExt : public QButtonGroup
@mistic100
mistic100 / IdenticonPlus.php
Last active February 18, 2019 07:33
PHP implementation of Don Park Identicon algorithm with additional shapes and variations
<?php
/**
* Identicon++
*
* @description: PHP implementation of Don Park Identicon algorithm with additional shapes and variations.
*
* @author: Damien "Mistic" Sorel - http://strangeplanet.fr
* @license: MIT
* @version: 2.0.0
* @date: 21/05/2015