Skip to content

Instantly share code, notes, and snippets.

View danklammer's full-sized avatar

Dan Klammer danklammer

View GitHub Profile
@desandro
desandro / classie.js
Last active November 9, 2017 14:41
classie - class helper functions
/*!
* classie - class helper functions
* from bonzo https://github.com/ded/bonzo
*
* classie.has( elem, 'my-class' ) -> true/false
* classie.add( elem, 'my-new-class' )
* classie.remove( elem, 'my-unwanted-class' )
*/
/*jshint browser: true, strict: true, undef: true */
@tlongren
tlongren / functions.php
Last active September 24, 2018 13:48
Add Open Graph Markup to WordPress Theme
<?php
function add_opengraph_markup() {
if (is_single()) {
global $post;
if(get_the_post_thumbnail($post->ID, 'thumbnail')) {
$thumbnail_id = get_post_thumbnail_id($post->ID);
$thumbnail_object = get_post($thumbnail_id);
$image = $thumbnail_object->guid;
} else {
// set default image
@simurai
simurai / README.md
Last active November 28, 2019 05:39
Atom for minimalists

For minimalist ❤️ ers

minimalist

Just you, your code and nothing else.... :meditatingbuddha:

<!DOCTYPE html>
<meta charset="utf-8" />
<body
style="position: fixed; left: 0px; right: 0px; top: 0px; bottom: 0px; overflow: hidden; margin: 0; padding: 0;"
>
<canvas
id="canvas"
style="width: 100%; height: 100%; padding: 0;margin: 0;"
></canvas>
<script>
@fjaguero
fjaguero / wp_alt_title_thumb.php
Created October 9, 2012 11:17
Wordpress: Get ALT and TITLE for the post thumbnail
<?php if ( has_post_thumbnail() ) :?>
<a href="<?php the_permalink() ?>" class="thumb"><?php the_post_thumbnail('thumbnail', array(
'alt' => trim(strip_tags( $post->post_title )),
'title' => trim(strip_tags( $post->post_title )),
)); ?></a>
<?php endif; ?>
@windyjonas
windyjonas / wordpress-escaping.md
Last active September 21, 2020 16:10
Most of the escaping functions in WordPress, with a short explanation and example.

WordPress escaping functions

By: Jonas Nordström, @windyjonas
Date: 2013-04-16

esc_attr( $text );
Encodes the <, >, &, " and ' (less than, greater than, ampersand, double quote and single quote) characters. Will never double encode entities.
Example:

@sgelob
sgelob / user-timing-api-RUM-gtm.js
Last active March 14, 2021 05:03
Real User Monitoring of Web Performance with Navigation Timing API, Google Tag Manager and Google Analytics
/**
* user-timing-api-RUM-gtm.js 1.0.1
* Olegs Belousovs @sgelob
*/
(function() {
"use strict";
// From https://github.com/addyosmani/timing.js/ –––>
var performance = window.performance || window.webkitPerformance || window.msPerformance || window.mozPerformance;
@ricealexander
ricealexander / system_fonts.css
Last active March 31, 2021 01:56
system fonts across platforms
:root {
--system-sans-serif:
system-ui, /* detect system font automatically */
-apple-system, /* Safari (Mac OS X and iOS) and Older Mac OS X */
BlinkMacSystemFont, /* Chrome<56 (Mac OS X) */
"Segoe UI", /* Windows and Windows Phone */
"Roboto", /* Android and Chrome OS */
"Oxygen", /* KDE - Linux environment */
"Ubuntu", /* Ubuntu - Linux distribution */
"Cantarell", /* GNOME - Linux environment */
@jpravetz
jpravetz / product_generator.rb
Created December 2, 2011 21:24
Jekyll generator to read json data file and generate product and ingredient pages
#------------------------------------------------------------------------
# encoding: utf-8
# @(#)product_generator.rb 1.00 29-Nov-2011 16:38
#
# Copyright (c) 2011 Jim Pravetz. All Rights Reserved.
# Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
#
# Description: A generator that creates product, products and
# ingredients pages for jekyll sites. Uses a JSON data
# file as the database file from which to read and
@cawa87
cawa87 / base64.js
Last active August 26, 2021 07:36
JavaScript Convert an image to a base64 url
/**
* Convert an image
* to a base64 url
* @param {String} url
* @param {Function} callback
* @param {String} [outputFormat=image/png]
*/
function convertImgToBase64URL(url, callback, outputFormat){
var img = new Image();
img.crossOrigin = 'Anonymous';