Skip to content

Instantly share code, notes, and snippets.

@ErickPetru
ErickPetru / worktree-publish-to-gh-pages.md
Created September 13, 2019 13:26
Publishing a `dist` folder from `master` branch using **worktree** feature to `gh-pages` branch.

Setup

First of all, you need to have a gh-pages. If you don't have, create:

git branch gh-pages

This makes a branch based on the master HEAD. It would be okay but the files and the git history of master branch are not meaningful on gh-pages branch.

@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active October 24, 2024 18:10
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@nikahmadz
nikahmadz / ThemeBasics.md
Last active July 28, 2024 17:14
Tutorial Notes On Building A Blogger Theme

Theme Basics

Theme Basics is a series of tutorial notes on building a Blogger theme.

Discover tips and learn how to start building your own Blogger theme:

  • Minimum code requirements.
  • Basic templates.
  • Tags & Data definitions.
  • Resources and examples.
@nickdavis
nickdavis / functions.php
Created February 28, 2017 10:29
Add 'no-js' class to <html> tag in WordPress in order to work with Modernizr
<?php
add_filter( 'language_attributes', 'add_no_js_class_to_html_tag', 10, 2 );
/**
* Add 'no-js' class to <html> tag in order to work with Modernizr.
*
* (Modernizr will change class to 'js' if JavaScript is supported).
*
* @since 1.0.0
*
@sethbergman
sethbergman / WP-HTML-Compression
Created November 3, 2015 03:27
Minify HTML for WordPress without a Plugin - Add to function.php
<?php
class WP_HTML_Compression
{
// Settings
protected $compress_css = true;
protected $compress_js = true;
protected $info_comment = true;
protected $remove_comments = true;
// Variables
@ziggi
ziggi / parents.js
Last active August 11, 2022 16:10
Vanilla JS jQuery.parents() realisation (npm module: https://github.com/ziggi/dom-parents)
Element.prototype.parents = function(selector) {
var elements = [];
var elem = this;
var ishaveselector = selector !== undefined;
while ((elem = elem.parentElement) !== null) {
if (elem.nodeType !== Node.ELEMENT_NODE) {
continue;
}
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active November 2, 2024 08:30
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@kasparsd
kasparsd / wordpress-plugin-svn-to-git.md
Last active August 16, 2024 17:33
Using Git with Subversion Mirroring for WordPress Plugin Development
@yoshimov
yoshimov / gist:2146576
Created March 21, 2012 12:21
Bookmarklet to create QR code for current page.
javascript:(function(){var l=window.location.href;void(window.open('https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl='+l,'_blank'));})()