This file contains hidden or 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
#include <Adafruit_NeoPixel.h> | |
// Definicje pinów | |
#define LED_PIN 20 // 8 // Pin do którego podłączone są LEDy | |
#define BUZZER_PIN 6 // Pin do którego podłączony jest buzzer | |
#define NUM_LEDS 16 // Liczba LEDów w pasku | |
// Utworzenie obiektu NeoPixel | |
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, LED_PIN, NEO_GRB + NEO_KHZ800); |
This file contains hidden or 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 sendWithPhpMailer($subject, $body, $reply) { | |
require(ABSPATH . WPINC . '/class-phpmailer.php'); | |
require(ABSPATH . WPINC . '/class-smtp.php'); | |
// date_default_timezone_set( 'America/Sao_Paulo' ); | |
$blogname = wp_strip_all_tags( trim( get_option( 'blogname' ) ) ); | |
$smtpHost = wp_strip_all_tags( trim( get_option( 'smtp_host' ) ) ); |
This file contains hidden or 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 | |
/** | |
* Adapted from https://wordpress.stackexchange.com/a/191974/8591 | |
* | |
* Send mail, similar to PHP's mail | |
* | |
* A true return value does not automatically mean that the user received the | |
* email successfully. It just only means that the method used was able to | |
* process the request without any errors. | |
* |
This file contains hidden or 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 | |
add_action('rest_api_init', function () { | |
register_rest_route( 'contact/v1', 'send', [ | |
'methods' => 'POST', | |
'callback' => 'api_send_contact_form' | |
]); | |
}); | |
function api_send_contact_form( $request ) { |
This file contains hidden or 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_custom_post_meta_cb($object, $field_name, $request) { | |
return get_post_meta( $object['id'], $field_name, true ); | |
} | |
function get_custom_post_meta_cb_the_content($object, $field_name, $request) { | |
return apply_filters( 'the_content', get_post_meta( $object['id'], $field_name, true ) ); | |
} |
This file contains hidden or 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 theme_metabox_per_page() { | |
global $pagenow; | |
if ( $pagenow == 'post.php' ) { | |
$page_id = ( $_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['post_ID'] ) ? $_POST['post_ID'] : $_GET['post']; | |
if ( $page_id ) { | |
$page_slug = get_post_field( 'post_name', $page_id ); |
This file contains hidden or 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 throttle(callback, wait, immediate = false) { | |
let timeout = null | |
let initialCall = true | |
return function() { | |
const callNow = immediate && initialCall | |
const next = () => { | |
callback.apply(this, arguments) | |
timeout = null | |
} |
This file contains hidden or 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 debounce(callback, wait, immediate = false) { | |
let timeout = null | |
return function() { | |
const callNow = immediate && !timeout | |
const next = () => callback.apply(this, arguments) | |
clearTimeout(timeout) | |
timeout = setTimeout(next, wait) |
This file contains hidden or 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
{"lastUpload":"2020-04-16T08:40:00.656Z","extensionVersion":"v3.4.3"} |
This file contains hidden or 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
/* | |
* Easing Functions - inspired from http://gizma.com/easing/ | |
* only considering the t value for the range [0, 1] => [0, 1] | |
*/ | |
EasingFunctions = { | |
// no easing, no acceleration | |
linear: t => t, | |
// accelerating from zero velocity | |
easeInQuad: t => t*t, | |
// decelerating to zero velocity |
NewerOlder