Skip to content

Instantly share code, notes, and snippets.

@aileftech
aileftech / hex-colors.txt
Created October 1, 2022 18:10
A Bash one-liner to produce a list of HEX color codes that read like (supposedly) valid English words
$ grep -P "^[ABCDEFabcdefOoIi]{6,6}$" /usr/share/dict/words | tr 'OoIi' '0011' | tr '[:lower:]' '[:upper:]' | awk '{print "#" $0}'
#ACAD1A
#B0BB1E
#DEBB1E
#AB1DED
#ACAC1A
#ACCEDE
#AC1D1C
#BAB1ED
#BA0BAB
@carlosramireziii
carlosramireziii / admin.html.erb
Last active May 19, 2021 17:53
"Best Practices For Building A Rails Admin Interface From Scratch" sample setup
<% # app/views/layouts/admin.html.erb %>
<!DOCTYPE html>
<html>
<head>
<title>Admin Interface</title>
<%= csrf_meta_tags %>
<% # Optionally use admin-specific assets here instead of the normal application assets %>
<%= stylesheet_link_tag 'admin', media: 'all', 'data-turbolinks-track': 'reload' %>
@yunusga
yunusga / gist:33cf0ba9e311e12df4046722e93d4123
Created April 5, 2017 11:55
Debug WordPress 404 issues (permalinks, rewrite rules, etc.)
/* Produces a dump on the state of WordPress when a not found error occurs */
/* useful when debugging permalink issues, rewrite rule trouble, place inside functions.php */
ini_set( 'error_reporting', -1 );
ini_set( 'display_errors', 'On' );
echo '<pre>';
add_action( 'parse_request', 'debug_404_rewrite_dump' );
function debug_404_rewrite_dump( &$wp ) {
@awkale
awkale / rails_g.rb
Last active June 13, 2023 03:19
rails generators #rails #cheatsheet
# Controller Plural
rails g controller Users index show
# Helper Plural
rails g helper Users
# Mailer Singular
rails g mailer UserMailer
# Migration Plural
@ayamflow
ayamflow / gist:b602ab436ac9f05660d9c15190f4fd7b
Created May 9, 2016 19:10
Safari border-radius + overflow: hidden + CSS transform fix
// Add on element with overflow
-webkit-mask-image: -webkit-radial-gradient(white, black);
@jplhomer
jplhomer / woocommerce-alter-cart-total.php
Last active July 10, 2021 01:53
Programmatically alter the WooCommerce cart discount total (and apply a new discount) before it's calculated through the woocommerce_calculate_totals hook. Add this code to your Wordpress functions.php file.
<?php
/**
* Programmatically alter the WooCommerce cart discount total (and apply a new discount) before it's calculated
* through the woocommerce_calculate_totals hook.
*
* For example, if you want to apply an arbitrary discount after a certain number of products in the cart,
* you can loop through that number and increment it as needed.
*
* In this example, I increment the discount by $8.85 after every 15 products added to the cart.
*
@danott
danott / entities.css
Created January 31, 2011 22:07
Use CSS's :after pseudo-selector to insert hexadecimal values of html entities into the document. Less markup. More awesome.
/* Daniel Ott
* entities.css
* 31 January 2011
*
* Adding arrows to thinks makes them more clickable. Right?
* Use CSS's :after pseudo-selector to insert hexadecimal values
* of html entities into the document. Less markup. More awesome.
*/
.add-an-arrow:after {