Skip to content

Instantly share code, notes, and snippets.

Avatar

shesgottadevelopit shesgottadevelopit

View GitHub Profile
@clarklab
clarklab / block-helpers.php
Last active Nov 23, 2020
Wordpress check if block is used first
View block-helpers.php
<?php
/**
* Block helpers
* add special classes when certain blocks appear, put this in your functions.php file or include it somewhere
*/
// add block classes in body and post class
function blocks_body_class( $classes ) {
global $post;
View markdown.reg
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.md]
@="markdown"
[HKEY_CLASSES_ROOT\.md\ShellNew]
"NullFile"=""
[HKEY_CLASSES_ROOT\markdown]
@="Blank Markdown file"
@atelierbram
atelierbram / set-active-class-in-nunjucks.md
Last active Sep 15, 2020
Set Active Class on Nav-Menu-Item in Nunjucks
View set-active-class-in-nunjucks.md

In html/about/index.html:

{% extends "layouts/layout.njk" %}

{% set base_path = "../../" %}
{% set page_title = "about" %} 

In data.json:

@daraul
daraul / decodeHtmlspecialChars.js
Last active Dec 23, 2020
Decode PHP's htmlspecialchars encoding with Javascript
View decodeHtmlspecialChars.js
return function(text) {
var map = {
'&amp;': '&',
'&#038;': "&",
'&lt;': '<',
'&gt;': '>',
'&quot;': '"',
'&#039;': "'",
'&#8217;': "’",
'&#8216;': "‘",
@3200creative
3200creative / functions.php
Created Mar 11, 2015
Section With Wrap Shortcode
View functions.php
//* Page Section with field for unique class.
function contentSection( $atts, $content = null ) {
$content = preg_replace('#^<\/p>|<p>$#', '', $content);
$a = shortcode_atts( array(
'class' => 'Add Classes Here',
), $atts );
return '<div class="full-block '."{$a['class']}".' "><div class="wrap">' . do_shortcode($content) . '</div></div>';
}
@rxaviers
rxaviers / gist:7360908
Last active May 6, 2021
Complete list of github markdown emoji markup
View gist:7360908

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@don1138
don1138 / font-stacks.css
Last active Apr 30, 2021
CSS Modern Font Stacks
View font-stacks.css
/* Modern Font Stacks */
/* System */
font-family: system, -apple-system, ".SFNSText-Regular", "San Francisco", "Roboto", "Segoe UI", "Helvetica Neue", "Lucida Grande", sans-serif;
/* Times New Roman-based serif */
font-family: Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif;
/* A modern Georgia-based serif */
font-family: Constantia, "Lucida Bright", Lucidabright, "Lucida Serif", Lucida, "DejaVu Serif", "Bitstream Vera Serif", "Liberation Serif", Georgia, serif;
@studiopress
studiopress / allowed-tags.php
Last active Jun 26, 2020
Genesis comments.
View allowed-tags.php
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Remove comment form allowed tags
add_filter( 'comment_form_defaults', 'sp_remove_comment_form_allowed_tags' );
function sp_remove_comment_form_allowed_tags( $defaults ) {
$defaults['comment_notes_after'] = '';
return $defaults;
@justinph
justinph / validate_gravatar.php
Created Mar 19, 2013
In wordpress, a better way to check if an author has a gravatar or not. Sometimes you might want to check to see if a gravatar exists and not display any image if there isn't one. Uses the wordpress HTTP and caching apis. A better version of this: http://codex.wordpress.org/Using_Gravatars#Checking_for_the_Existence_of_a_Gravatar
View validate_gravatar.php
/**
* Utility function to check if a gravatar exists for a given email or id
* @param int|string|object $id_or_email A user ID, email address, or comment object
* @return bool if the gravatar exists or not
*/
function validate_gravatar($id_or_email) {
//id or email code borrowed from wp-includes/pluggable.php
$email = '';