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
| from dotenv import load_dotenv | |
| from livekit import agents | |
| from livekit.agents import Agent, AgentSession | |
| from livekit.plugins import elevenlabs | |
| load_dotenv() | |
| class Assistant(Agent): | |
| def __init__(self) -> None: |
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
| UPDATE TABLE_NAME | |
| SET location_hash = CASE | |
| -- Set to NULL if address_1 or city or zip is null | |
| WHEN address_1 IS NULL OR city IS NULL OR zip IS NULL | |
| THEN NULL | |
| ELSE md5(CONCAT( | |
| -- Standardize the combined street address | |
| COALESCE( | |
| -- Hack to set to NULL if standardize_address returns row with all empty fields | |
| NULLIF( |
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
| const fs = require('fs') | |
| const pug = require('pug') | |
| const glob = require('glob') | |
| const templateRegex = new RegExp('<template lang="pug">(.*)</template>', 's') | |
| const attributeRegex = new RegExp(/(\S*)="/, 'g') | |
| function compilePug(pugCode) { | |
| let cleanedPug = pugCode.split('\n').filter(line => line.trim().length > 0) | |
| const initialTab = cleanedPug[0].match(/^\s*/)[0] |
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 loadStuff() { | |
| state.loading = true | |
| fetch('//myapi.com/stuff') | |
| .then(res => res.json()) | |
| .then(data => { | |
| state.loading = false | |
| state.stuff = data | |
| }) | |
| } |
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
| import tuxi from 'tuxi' | |
| import Vuex from 'vuex' | |
| import Vue from 'vue' | |
| import api from './api' | |
| Vue.use(Vuex) | |
| const store = new Vuex.Store({ | |
| strict: true, // tuxi works in strict mode! | |
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
| <template> | |
| <div class="wrapper"> | |
| <div class="empty-message" v-if="articlesTask.empty"> | |
| No articles | |
| </div> | |
| <div class="spinner" v-if="articlesTask.spinning"> | |
| Loading articles... | |
| </div> |
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
| import tuxi from 'tuxi' | |
| import api from './api' | |
| const articlesTask = tuxi.task(api.fetchArticles) | |
| // ⚡ Fire the api call | |
| articlesTask.start() | |
| // The task is immediately set to pending | |
| console.log(articlesTask.pending) // 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
| /** | |
| * Create a Vuex store module to represent states for an asynchronous API getter. | |
| * | |
| * Includes defaultState, actions, and mutations for a standard value gotten via asynchronous call. | |
| * See defaultState() function for list of states included. | |
| * | |
| * Usage: | |
| * Assuming we have an async call to get documents (getDocuments) which takes a payload object as an arg, here's what we can do: | |
| * | |
| * ----- store.js ----- |
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
| // Cypress-ized and modified version of https://github.com/kemokid/scripting-sortable/blob/master/script_sortable_dnd.js | |
| export function triggerSortableDragAndDrop(elemDrag, elemDrop) { | |
| /* | |
| Summary of what events this fires: | |
| On elemDrag: | |
| mouseDown | |
| dragstart | |
| On elemDrop: | |
| dragover (repeat until it moves) |
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
| const progress = Array.from( | |
| document.querySelectorAll('p[class^="progressNumbers"]') | |
| ) | |
| .map(x => x.innerText) | |
| .map(txt => { | |
| let parsed = txt.match(/(\d+) of (\d+) complete/); | |
| return { done: parseInt(parsed[1]), total: parseInt(parsed[2]) }; | |
| }); | |
| const done = progress.map(unit => unit.done).reduce((acc, val) => acc + val); |
NewerOlder