This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const { series, src, watch, dest } = require('gulp'); | |
const sass = require('gulp-sass'); | |
const autoprefixer = require('gulp-autoprefixer'); | |
sass.compiler = require('dart-sass'); | |
const wpPot = require('gulp-wp-pot'); | |
const sass_src = 'wp-content/themes/theme-name/scss/**/{*.scss,_*.scss}'; | |
const sass_dest = 'wp-content/themes/theme-name/'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SEARCH_DATA = `path/to/csv-file.csv`; | |
const Search = { | |
SEPARATOR_LINE: '\n', | |
SEPARATOR_COLUMN: ';', | |
jsonData: [], | |
initialize: () => { | |
fetch(SEARCH_DATA) | |
.then(response => response.text()) | |
.then(data => { | |
//console.log(data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function uniqueValues(accumulator, currentValue) { | |
return accumulator.indexOf(currentValue) < 0 ? accumulator.concat(currentValue) : accumulator; | |
} | |
//Example: | |
//[11,22,33,11,33,55].reduce(uniqueValues, []); | |
// -> Output: [11,22,33,55] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const { series, src, watch, dest } = require('gulp'); | |
const sass = require('gulp-sass'); | |
const autoprefixer = require('gulp-autoprefixer'); | |
sass.compiler = require('dart-sass'); | |
const sass_src = 'wp-content/themes/example-theme/sass/**/{*.scss,_*.scss}'; | |
const sass_dest = 'wp-content/themes/example-theme/'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="javascript:(function(){document.querySelectorAll('.TaskGroupHeader-toggleButton .DownTriangleIcon').forEach(function(element){ element.parentNode.click() })}());">Asana: Collapse All Projects</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// $yt_block_code = extract_youtube_block_gutenberg( get_the_content() ); | |
function extract_youtube_block_gutenberg( $the_content ) { | |
$yt_begin_phrase = 'wp:core-embed/youtube'; | |
if( strpos ($the_content, $yt_begin_phrase ) === false ){ | |
return null; | |
} | |
$yt_embed_begin = strpos( $the_content, $yt_begin_phrase ) + strlen( $yt_begin_phrase ); | |
$yt_embed_end = strpos( $the_content, '-->' ); | |
$yt_block_code = json_decode(trim(substr( $the_content, $yt_embed_begin, $yt_embed_end - $yt_embed_begin ))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// auto cache bust (style) | |
function acb_style( $name, $css, $deps = [] ) { | |
wp_enqueue_style( $name, get_template_directory_uri() . $css, $deps, filemtime( get_template_directory() . $css ) ); | |
} | |
// auto cache bust (script) | |
function acb_script( $name, $js, $deps = [], $in_footer = false ) { | |
if( $in_footer ): | |
wp_enqueue_script( $name, get_template_directory_uri() . $js, $deps, filemtime( get_template_directory() . $js ), $in_footer ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
const base_path = 'https://example.com/base/path/'; | |
function addStyle(name) { | |
const path = base_path + 'css/' + name + '?v=' + Date.now(); | |
const link = document.createElement('link'); | |
link.rel = 'stylesheet'; | |
link.type = 'text/css'; | |
link.href = path; | |
document.head.appendChild(link); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
'method': 'POST', | |
'url': '/path/to/api', | |
'dataType': 'json', | |
'contentType': 'application/json; charset=UTF-8', | |
'data': JSON.stringify({ | |
"key": false | |
"key2": 'value', | |
"key3": 42 | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// dart-sass (v1.18.0) | |
// ---- | |
$breakpoints: ( | |
"sm": 576px, | |
"md": 768px, | |
"lg": 992px, | |
"xl": 1200px | |
); |