Skip to content

Instantly share code, notes, and snippets.

@centaurialpha
centaurialpha / qt_icons.py
Last active April 23, 2026 03:31
Show all standard Qt icons
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWidgets import QWidget
from PyQt5.QtWidgets import QPushButton
from PyQt5.QtWidgets import QGridLayout
from PyQt5.QtWidgets import QStyle
COL_SIZE = 4
class Widget(QWidget):
@Behinder
Behinder / gist:166bf67259268caa98675c849ecf0395
Created April 18, 2020 15:27
Increment and decrement float in PHP
function incrementFLoat($float){
echo $float."\n";
$decimal = strlen(strrchr($float, '.')) -1;
$factor = pow(10,$decimal);
$incremented = (($factor * $float) + 1) / $factor;
return $incremented;
}
function decrementFLoat($float){
// get amount of decimals
@bradtraversy
bradtraversy / docker_wordpress.md
Last active October 2, 2026 13:07
Docker Compose FIle For Wordpress, MySQL & phpmyadmin

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes
@maddisondesigns
maddisondesigns / functions.php
Last active August 5, 2025 09:32
WooCommerce Custom Fields for Simple & Variable Products
/*
* Add our Custom Fields to simple products
*/
function mytheme_woo_add_custom_fields() {
global $woocommerce, $post;
echo '<div class="options_group">';
// Text Field
@Crissov
Crissov / fb-emoji-scraper.js
Last active August 15, 2018 16:34
Scrape Facebook emojis
let content_security_policy = "script-src 'self'; object-src 'self' https://www.facebook.com/"; // for running in Chrome's JS console
/* Let’s see which Unicode 10.0 emojis Facebook already supports.
<https://github.com/Crissov/unicode-proposals/issues/254#issuecomment-284831620> */
let myEmojis = new Map([
['1f6f7', 'U+1F6F7 🛷 SLED'],
['1f6f8', 'U+1F6F8 🛸 FLYING SAUCER'],
['1f91f', 'U+1F91F 🤟 I LOVE YOU HAND SIGN'],
['1f928', 'U+1F928 🤨 FACE WITH ONE EYEBROW RAISED'],
['1f929', 'U+1F929 🤩 GRINNING FACE WITH STAR EYES'],
['1f92a', 'U+1F92A 🤪 GRINNING FACE WITH CRAZY EYES'],
@vinicius-stutz
vinicius-stutz / Google Chrome Favicons For Bookmarklets.md
Last active October 1, 2026 02:04
Google Chrome Favicons For Bookmarklets

Google Chrome Favicons For Bookmarklets

The traditional and happy way

  1. Open the Bookmark Manager and export your bookmarks;
  2. Open the exported html file in your favorite editor and look for the bookmarklet you want a favicon applied to;
  3. Convert the 16x16 px (or greater) favicon you want to use into the BASE64 format (I used Base64 Image Encoder);
  4. Now you can add the favicon via adding the ICON="data:image/insert-your-base64-image-code-here" attribute in the link;
  5. Save the file and import it in the bookmark manager.

Done!

@toshimaru
toshimaru / jquery-scroll-bottom.js
Last active March 25, 2026 00:25
Detect the scrolling to bottom of the page using jQuery.
$(window).on("scroll", function() {
var scrollHeight = $(document).height();
var scrollPosition = $(window).height() + $(window).scrollTop();
if ((scrollHeight - scrollPosition) / scrollHeight === 0) {
// when scroll to bottom of the page
}
});
@kamranzafar
kamranzafar / toast.js
Created July 18, 2012 14:40
JQuery Mobile Android-style Toast popup
var toast=function(msg){
$("<div class='ui-loader ui-overlay-shadow ui-body-e ui-corner-all'><h3>"+msg+"</h3></div>")
.css({ display: "block",
opacity: 0.90,
position: "fixed",
padding: "7px",
"text-align": "center",
width: "270px",
left: ($(window).width() - 284)/2,
top: $(window).height()/2 })