Skip to content

Instantly share code, notes, and snippets.

View asha23's full-sized avatar
🎩
Working from home

Ash Whiting asha23

🎩
Working from home
View GitHub Profile
<?php $video_id = 'the video id'; ?>
<div id="wistia_<?= $video_id; ?>" class="wistia_embed_api wistia_async_<?= $video_id; ?> popover=false wistia_embed_wrapper" data-video="<?= $video_id; ?>"></div>
@asha23
asha23 / contents.html
Created November 3, 2020 12:57
Table Of Contents - Dynamically creates contents based on heading tags in the page
<div id="bl-toc-container" class="bl-toc-transparent">
<div class="bl-toc-title-container">
<p class="bl-toc-title">Contents</p>
</div>
</div>
@asha23
asha23 / wistia.js
Last active October 15, 2020 10:51
function parentWidth(elem) {
return elem.parentElement.clientWidth;
}
var xhr = new XMLHttpRequest();
var baseUrl = "https://fast.wistia.com/oembed/?url=";
var accountUrl = encodeURIComponent("https://home.wistia.com/medias/");
var wistiaId = document.querySelector('.wistia_embed').getAttribute('data-wistia-id');
console.log("aaa");
var image_size = parentWidth(document.querySelector(".embed-responsive"));//value in px
console.log(image_size);
@asha23
asha23 / chatbot.html
Last active October 6, 2020 11:15
Zendesk Improvement
<script>
(function () {
function ZendeskCustomWidget() {
this.element = document.getElementById('zendesk-widget-custom');
this.options = localStorage['ZD-store'] ? JSON.parse(localStorage['ZD-store']) : {
widgetShown: false,
is_chatting: false
};
@asha23
asha23 / spacing.scss
Created March 3, 2020 14:10
Create margins and padding using an scss loop
// Create a load of padding and margin classes
@for $i from 1 through 20 {
.mt-#{$i} {
margin-top:#{$i}rem!important;
}
.mb-#{$i} {
margin-bottom:#{$i}rem!important;
@asha23
asha23 / languages.txt
Created January 30, 2020 13:48
Languages of the world
Acholi
Afrikaans
Akan
Albanian
Amharic
Arabic
Ashante
Asl
Assyrian
Azerbaijani
@asha23
asha23 / wp_api.php
Created November 7, 2019 15:58
WP API
public function wp_connection()
{
$curl = curl_init();
curl_setopt_array($curl,
[
CURLOPT_URL => "https://www.host.com/wp-json/acf/v3/product",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
@asha23
asha23 / nginx.conf
Created October 28, 2019 10:04
NGINX Multisite
server {
listen 80;
listen 443 ssl http2;
server_name .test.test;
root "/home/vagrant/code/test";
index index.php index.html index.htm;
charset utf-8;
@asha23
asha23 / wp-temp-loaded.php
Created October 28, 2019 10:01
Show which WordPress template is loaded
function ash_which_template_is_loaded() {
if ( is_super_admin() ) {
global $template;
print_r( $template );
}
}
add_action( 'wp_footer', 'ash_which_template_is_loaded' );
@asha23
asha23 / WP_All_Queries.php
Created September 9, 2019 09:26
WORDPRESS: Just show all the queries on page load
define('SAVEQUERIES', true);
if (current_user_can('administrator')){
global $wpdb;
echo "<pre>";
print_r($wpdb->queries);
echo "</pre>";
}