Skip to content

Instantly share code, notes, and snippets.

@tunguskha
tunguskha / CSS-color-var.md
Last active May 20, 2024 06:21
Darken & Lighten colors in pure CSS using variables.
:root {
  /* Base color using HSL */
  --hue: 207;
  --saturation: 64%;
  --light: 44%;
  
  /* Base color in variable */
  --primary-color: hsl(var(--hue), var(--saturation), var(--light));
 /* Base color lighten using calc */
@nathanrice
nathanrice / modular-stylesheets.php
Last active April 11, 2020 14:36
A simple proof-of-concept for modularizing the CSS for each block, and linking it "just in time".
<?php
// this snippet requires PHP 5.3+
add_action( 'wp_enqueue_scripts', function() {
wp_register_style( 'atomic-blocks/ab-cta', '/path/to/atomic-blocks/css/ab-cta.css', array(), 1.0.0 );
} );
add_filter( 'render_block', function( $block_content, $block ) {
if ( 'atomic-blocks/ab-cta' === $block['blockName'] ) {
ob_start();
wp_print_styles( $block['blockName'] );
@alirobe
alirobe / reclaimWindows10.ps1
Last active June 7, 2024 16:24
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
@Critter
Critter / wordpress-widget.php
Created July 10, 2014 03:56
Exclude category from recent posts in widget
/**
* Recent_Posts widget w/ category exclude class
* This allows specific Category IDs to be removed from the Sidebar Recent Posts list
*
*/
class WP_Widget_Recent_Posts_Exclude extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_recent_entries', 'description' => __( "The most recent posts on your site") );
parent::__construct('recent-posts', __('Recent Posts with Exclude'), $widget_ops);
@ryanburnette
ryanburnette / markdown_filters.php
Last active January 12, 2016 07:28
WordPress filters for converting to and from Markdown using WP-Markdown plugin.
<?php
// functions.php
if ( function_exists(wpmarkdown_markdown_to_html) && function_exists(wpmarkdown_html_to_markdown) ) {
function markdown_to_html_func($content) {
if ( function_exists('wpmarkdown_markdown_to_html') ) {
return wpmarkdown_markdown_to_html($content);
}
return $content;
}
add_filter('markdown_to_html','markdown_to_html_func');
@joaocunha
joaocunha / How To Hide The Select Arrow On Firefox.md
Last active December 10, 2023 13:05
How to hide <select> dropdown's arrow in Firefox when using "-moz-appearance: none;".

This is no longer a bug. I'm keeping the gist for historical reasons, as it helped to get it fixed. Make sure to read the notes by the end of the post.

How to remove hide the select arrow in Firefox using -moz-appearance:none;

TL;DR (or, the fix)

  1. Set -moz-appearance to none. This will "reset" the styling of the element;
  2. Set text-indent to 0.01px. This will "push" the text a tiny bit[1] to the right;
@r-a-y
r-a-y / gist:5209075
Created March 20, 2013 22:20
Lightweight, frontend version of admin-ajax.php for WordPress.
<?php
/**
* Lightweight, frontend version of admin-ajax.php.
*
* Only loads wp-load.php and sets up the headers and AJAX actions.
*/
// Setup 'DOING_AJAX' constant to be compatible with native WP functionality
define( 'DOING_AJAX', true );
@lavoiesl
lavoiesl / .htaccess
Created November 21, 2012 19:37
Automatically compile LESS files
# LESS compiler
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} ^(.*)\.css
RewriteCond %1.less -f
RewriteRule ^(.*)\.css lessphp/less.php?f=$1.less
@thefuxia
thefuxia / plugin-class-demo.php
Last active April 11, 2024 13:50
Plugin Class Demo
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: Plugin Class Demo
* Description: How I am using the base class in plugins.
* Plugin URI:
* Version: 2012.09.29
* Author: Fuxia Scholz
* License: GPL
* Text Domain: plugin_unique_name
* Domain Path: /languages