Skip to content

Instantly share code, notes, and snippets.

View baezor's full-sized avatar

Angel Baez baezor

View GitHub Profile
@baezor
baezor / livedemo.js
Created October 3, 2022 11:21
Live Demo
import { getDeepgramToken, getWebSocketURL, createSocket } from "../lib/utils";
class Demo {
constructor(node, language) {
this.block = node;
this.language = language;
this.state = "waiting";
this.lngDropdown = this.block.querySelector(".dg-lv-dropdown-container");
this.background = this.block.querySelector(".dg-lv-background");
this.startMessage = this.block.querySelector(".tl-start-message");
async requestAudio(audio) {
// TODO: create a waiting state
/**
* @param {string} audio - The audio file to be requested
* GET /.netlify/functions/deepgram_token HTTP/1.1
* Host: ubiquitous-otter-a04e78-library.netlify.app
*
* POST /.netlify/functions/transcribe-prerecorded HTTP/1.1
* Host: ubiquitous-otter-a04e78-library.netlify.app
* Content-Type: application/json
@baezor
baezor / chrome-canary-disabled-cors.sh
Created August 16, 2022 21:08
Open Chrome Canary in MacOS with CORS disabled
# Be careful. This is only for emergencies.
open -na Google\ Chrome\ Canary --args --user-data-dir=/tmp/temporary-chrome-profile-dir --disable-web-security
<svg id="chart-1" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 580" style="enable-background:new 0 0 1000 580;" xml:space="preserve">
<g id="grid">
<g>
<line data-ignore="true" class="st0" x1="380.5" y1="0" x2="380.5" y2="580"/>
<line data-ignore="true" class="st0" x1="623.8" y1="0" x2="623.8" y2="580"/>
<line data-ignore="true" class="st0" x1="867.2" y1="0" x2="867.2" y2="580"/>
<line data-ignore="true" class="st0" x1="137.2" y1="0" x2="137.2" y2="580"/>
<line data-ignore="true" class="st0" x1="0" y1="149.6" x2="1000" y2="149.6"/>
<line data-ignore="true" class="st0" x1="0" y1="289.6" x2="1000" y2="289.6"/>
<line data-ignore="true" class="st0" x1="0" y1="429.6" x2="1000" y2="429.6"/>
<svg id="chart-1" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 580" style="enable-background:new 0 0 1000 580;" xml:space="preserve">
<g id="grid">
<line class="st0" x1="380.5" y1="0" x2="380.5" y2="580"/>
<line class="st0" x1="623.8" y1="0" x2="623.8" y2="580"/>
<line class="st0" x1="867.2" y1="0" x2="867.2" y2="580"/>
<line class="st0" x1="137.2" y1="0" x2="137.2" y2="580"/>
<line class="st0" x1="0" y1="149.6" x2="1000" y2="149.6"/>
<line class="st0" x1="0" y1="289.6" x2="1000" y2="289.6"/>
<line class="st0" x1="0" y1="429.6" x2="1000" y2="429.6"/>
<polyline class="st1" points="1000,580 0,580 0,0"/>
@baezor
baezor / concatenate_and_clean_csv_reports
Created July 6, 2021 01:54
First time using pandas
import os
import glob
import pandas as pd
from pandas.core.frame import DataFrame
os.chdir("all_files")
extension = 'csv'
files = glob.glob('*.{}'.format(extension))
def get_csv_file(path_to_dir):
@baezor
baezor / ready_stats_learndash_quizzes.py
Created June 30, 2021 19:11
Clean data to generate custom statistical reports from Learndash
import pandas as pd
from pandas.core.frame import DataFrame
df = pd.read_csv('sample.csv', skip_blank_lines=True, skiprows=[0])
df.columns = df.columns.str.strip().str.lower()
all_items = df['question'].to_list()
# get names of indexes for which
index_names = df[ df['question'] == ' TOTAL ' ].index
index_dividers = df[ df['question'] == 'QUIZ TITLE: Queremos conocerte' ].index
index_subdividers = df[ df['question'] == 'QUESTION'].index
@baezor
baezor / tareaEmiratesMaria.js
Created June 6, 2021 22:44
tareaEmiratesMaria.js
let allnodes = [];
const titles = document.querySelectorAll('.special-offers-card__title');
const nodes = document.querySelectorAll('.special-offers-card__discover');
for (let i = 0; i < nodes.length; i++) {
const title = titles[i].innerHTML;
const description = nodes[i].innerHTML;
const item = title + ': ' + description + ' ';
allnodes.push(item)
}
console.log('Te amo aquí está la lista de servicios: ', JSON.stringify(allnodes));
let filterState = {
state: []
}
function addActiveState(item) {
filterState.state.push(item)
}
function removeActiveState(item) {
<?php
/*
Template Name: Changelog
This page template is used to display the changelog
*/
$posts_per_page = 15;
$pg = ($_GET["pg"]) ? $_GET["pg"] : 1;
$offset = $posts_per_page * ($pg - 1);
$categories = get_terms(array(