Skip to content

Instantly share code, notes, and snippets.

@nunof07
nunof07 / custom.txt
Last active June 3, 2018 16:18
Phaser 3 export format for "Free texture packer"
{
"textures": [
{
"image": "{{config.imageName}}",
"format": "{{config.format}}",
"size": {
"w": {{config.imageWidth}},
"h": {{config.imageHeight}}
},
"scale": {{config.scale}},
@nunof07
nunof07 / setup.sql
Created April 5, 2019 16:20
Create WordPress admin account through SQL
INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`) VALUES ('your login', MD5('your password'), 'your name', 'your@email.com', '0');
INSERT INTO `wp_usermeta`(`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, (Select max(id) FROM wp_users), 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO `wp_usermeta`(`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, (Select max(id) FROM wp_users), 'wp_user_level', '10');
@nunof07
nunof07 / .gitignore
Created April 5, 2019 16:23
.gitignore for Sage theme
# 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
@nunof07
nunof07 / gist:1df943b59ec5a972e597a4c1bbfa46b4
Created April 5, 2019 16:24
.deployignore for DeployHQ and Sage theme
.cache-loader/**
node_modules/**
resources/assets/**
.deployignore
.editorconfig
.eslintrc.js
.gitignore
.gitlab-ci.yml
.stylelintrc.js
CHANGELOG.md
@nunof07
nunof07 / .eslintrc.js
Last active April 5, 2019 16:37
ESLint configuration for Sage theme
module.exports = {
'root': true,
'extends': [
'eslint:recommended',
'plugin:sonarjs/recommended',
'plugin:unicorn/recommended',
'es/2015/client',
],
'globals': {
'wp': true,
@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 / functions.php
Last active April 12, 2019 14:22
Add ACF option pages
<?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 April 12, 2019 14:22
Only show ACF admin page on local domain
<?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 / 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 / .stylelintrc.js
Last active April 29, 2019 16:05
Stylelint configuration for Sage theme
module.exports = {
'extends': 'stylelint-config-standard',
'rules': {
'no-empty-source': null,
'at-rule-no-unknown': [
true,
{
'ignoreAtRules': [
'extend',
'at-root',