Skip to content

Instantly share code, notes, and snippets.

@nunof07
nunof07 / functions.php
Last active April 12, 2019 14:22
Generate version identifier for WordPress theme (Sage) using webpack
<?php
/**
* Theme version string.
* Tries to read a "version.json" file in the "dist" folder - a JSON file with a "version" property.
* If this file is not available it returns the WordPress version.
*
* @return string
*/
function theme_version()
@nunof07
nunof07 / setup.php
Created April 12, 2019 14:23
Automatically register component aliases in Sage.
<?php
/**
* Register component aliases.
*/
add_action('after_setup_theme', function () {
$template_directory = "views/components/";
$path = get_stylesheet_directory() . '/' . $template_directory;
if (!is_dir($path)) {
@nunof07
nunof07 / ptmoviesearch.user.js
Last active February 14, 2020 14:58
Search for movies in Portuguese streaming services
// ==UserScript==
// @name PT Movie Search
// @namespace https://www.quasibit.com/
// @downloadUrl https://gist.github.com/raw/fa7a0e6427c2711f5612f02af3412b27/ptmoviesearch.user.js
// @updateUrl https://gist.github.com/raw/fa7a0e6427c2711f5612f02af3412b27/ptmoviesearch.user.js
// @match *://*/*
// @grant GM_openInTab
// @grant GM_registerMenuCommand
// @grant GM_setValue
// @grant GM_getValue