Skip to content

Instantly share code, notes, and snippets.

View jarridlima's full-sized avatar
🎯
Focusing

Jarrid Lima jarridlima

🎯
Focusing
View GitHub Profile
@jarridlima
jarridlima / google-sheets-format-json-data.js
Last active July 5, 2022 15:54
In this example, you can format data (rows and cols) became from public Google Sheets API in JSON format.
// ----------------------------------------
// IMPORTANT!!!
// ----------------------------------------
// FIRST OF ALL, REMEMBER TO TURN ON PUBLIC READ PERMISSION IN YOUR SPREADSHEET IN GOOGLE.
// ----------------------------------------
// BASE URL TO GET SHEET DATA
sheetsBaseURL = "https://docs.google.com/spreadsheets/d"
<?php
// Add this code in your 'theme folder' > functions.php
function my_customize_rest_cors() {
remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' );
add_filter( 'rest_pre_serve_request', function( $value ) {
header( 'Access-Control-Allow-Origin: *' );
header( 'Access-Control-Allow-Methods: GET' );
header( 'Access-Control-Allow-Credentials: true' );
@jarridlima
jarridlima / youtube-webhook.php
Last active April 15, 2021 02:23
Webhook Youtube Video
<?php
// https://pubsubhubbub.appspot.com/
// https://pubsubhubbub.github.io/PubSubHubbub/pubsubhubbub-core-0.4.html
// https://developers.google.com/youtube/v3/guides/push_notifications
// https://indieweb.org/How_to_publish_and_consume_WebSub#How_to_Subscribe
if(isset($_GET['hub_challenge'])){
// Resposta para verificação do webhook
echo $_GET['hub_challenge'];
@jarridlima
jarridlima / .js
Created January 23, 2020 15:09
JS REGEX pattern to URL validation
let patternUrl = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/
// source: https://www.regextester.com/94502
// ===============================
// Test strings:
// ===============================
// https://www.example.com
// http://www.example.com
// www.example.com