sass/
|
|– base/
| |– _reset.scss # Reset/normalize
| |– _typography.scss # Typography rules
| ... # Etc…
|
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 | |
function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) { | |
$query = new WP_Query( | |
array( | |
'post_type' => $post_type, | |
'title' => $page_title, | |
'post_status' => 'all', | |
'posts_per_page' => 1, | |
'no_found_rows' => true, | |
'ignore_sticky_posts' => true, |
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
export const pixelToPercent = (pixelNumber: number, containerSize: number) => { | |
const percent = 100 / containerSize * pixelNumber; | |
if (percent > 100) { | |
return 100; | |
} else if (percent < 0) { | |
return 0; | |
} | |
return Math.round((percent + Number.EPSILON) * 100) / 100; |
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
export const anyToArray = (value: any) => { | |
if (!value){ | |
return []; | |
} | |
if (Array.isArray(value)){ | |
return [...value]; | |
} | |
if (typeof value === 'object'){ |
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 | |
namespace ZeroWP; | |
class PostBlocks | |
{ | |
/** | |
* @param \WP_Post|int $post | |
* @param callable $callback | |
* |
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 | |
$flags = \FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS; | |
$iterator = new \FilesystemIterator(__DIR__, $flags); | |
foreach ($iterator as $path => $item) { | |
if ($item->isDir()) { | |
$muPath = trailingslashit($path); | |
$fileName = basename($item->getFileName()); | |
$filePath = "{$muPath}/{$fileName}.php"; |
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 | |
class ContactFormProcessing | |
{ | |
protected $action = 'example_contact_form'; | |
public function ajaxInit() | |
{ | |
add_action("wp_ajax_{$this->action}", [$this, 'process']); | |
add_action("wp_ajax_nopriv_{$this->action}", [$this, 'process']); | |
} |
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 | |
function everyTimeFrame($totalMinutes = 4, $lastSeconds = 16) | |
{ | |
$time = []; | |
for ($i = 0; $i <= 59; $i++) { | |
for ($j = 0; $j <= $totalMinutes; $j++) { | |
$second = strlen($i) > 1 ? $i : "0{$i}"; |
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
import Util from './util' | |
import Swipe from './swipe' | |
class Slider { | |
constructor( slider_el, options = {} ) { | |
// Default options | |
this.opt = { | |
inactiveClass: 'inactive-slide', | |
speed: 5000, | |
startAt: 0, |
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
class Person { | |
constructor($name){ | |
this._name = $name; | |
} | |
getName(){ | |
return `Hello ${this._name}`; | |
} | |
} |
NewerOlder