Skip to content

Instantly share code, notes, and snippets.

@nunof07
nunof07 / ptmoviesearch.user.js
Last active Feb 14, 2020
Search for movies in Portuguese streaming services
View ptmoviesearch.user.js
// ==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
@nunof07
nunof07 / setup.php
Created Apr 12, 2019
Automatically register component aliases in Sage.
View setup.php
<?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 / functions.php
Last active Apr 12, 2019
Generate version identifier for WordPress theme (Sage) using webpack
View functions.php
<?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 / .eslintrc.js
Last active Apr 5, 2019
ESLint configuration for Sage theme
View .eslintrc.js
module.exports = {
'root': true,
'extends': [
'eslint:recommended',
'plugin:sonarjs/recommended',
'plugin:unicorn/recommended',
'es/2015/client',
],
'globals': {
'wp': true,
@nunof07
nunof07 / .stylelintrc.js
Last active Apr 29, 2019
Stylelint configuration for Sage theme
View .stylelintrc.js
module.exports = {
'extends': 'stylelint-config-standard',
'rules': {
'no-empty-source': null,
'at-rule-no-unknown': [
true,
{
'ignoreAtRules': [
'extend',
'at-root',
@nunof07
nunof07 / functions.php
Last active Apr 12, 2019
Add ACF option pages
View functions.php
<?php
/**
* Unique identifier for the theme. Used for the text domain and other stuff.
*
* @return string
*/
function theme_key() {
return 'yourthemeid';
}
@nunof07
nunof07 / functions.php
Last active Apr 12, 2019
Only show ACF admin page on local domain
View functions.php
<?php
/**
* Determines if string ends with a specific sub string.
*
* @param string $haystack The string to search in.
* @param string $needle The sub-string to search for.
* @return boolean
*/
function string_ends_with($haystack, $needle) {
@nunof07
nunof07 / .gitlab-ci.yml
Last active May 3, 2019
GitLab CI to test Sage theme build
View .gitlab-ci.yml
image: edbizarro/gitlab-ci-pipeline-php:7.2-alpine-lts
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
- vendor/
- .yarn
before_script:
@nunof07
nunof07 / gist:1df943b59ec5a972e597a4c1bbfa46b4
Created Apr 5, 2019
.deployignore for DeployHQ and Sage theme
View gist:1df943b59ec5a972e597a4c1bbfa46b4
.cache-loader/**
node_modules/**
resources/assets/**
.deployignore
.editorconfig
.eslintrc.js
.gitignore
.gitlab-ci.yml
.stylelintrc.js
CHANGELOG.md
@nunof07
nunof07 / .gitignore
Created Apr 5, 2019
.gitignore for Sage theme
View .gitignore
# Include your project-specific ignores in this file
# Read about how to use .gitignore: https://help.github.com/articles/ignoring-files
.cache-loader
dist
node_modules
npm-debug.log
yarn-error.log
/vendor
resources/assets/config-local.json
.vscode