Skip to content

Instantly share code, notes, and snippets.

View simonexmachina's full-sized avatar

Simon Wade simonexmachina

  • Melbourne, Australia
View GitHub Profile
class UsefulSearchesService {
async init() {
this.data = await this.fetchData()
}
async get(params) {
setInterval(() => this.handleRefresh(), 0)
return this.data[params]
}
async handleRefresh() {
if (this.shouldRefresh()) {
@simonexmachina
simonexmachina / form-tracking.js
Last active May 13, 2020 12:57
Improving Elements Analytics - Proof of Concept
// Run addDataLayerTracking for each form to be tracked
// When the user enters invalid information call trackValidationError
export function addFormTracking(form) {
form.addEventListener('change', ev => {
let option = null
if (input.type == 'checkbox') {
option = input.checked ? 'Checked' : null
}
else if (input.type == 'radio') {
option = input.dataset.trackingLabel
"{\"packages/elements-storefront/src/components/PromotionalSpots/TemplateKitsPromotion/translations/translations.ru.js\":{\"newFeature\":\"NEW RELEASE\",\"heading\":\"Code-Free Websites\",\"subheading\":\"Template Kits are the easier, faster & flexible way to create WordPress websites.\",\"ctaText\":\"Discover Template Kits\"}}"
"{\"packages/elements-storefront/src/components/PromotionalSpots/TemplateKitsPromotion/translations/translations.de.js\":{\"newFeature\":\"NEW RELEASE\",\"heading\":\"Code-Free Websites\",\"subheading\":\"Template Kits are the easier, faster & flexible way to create WordPress websites.\",\"ctaText\":\"Discover Template Kits\"}}"
"{\"packages/elements-storefront/src/components/PromotionalSpots/TemplateKitsPromotion/translations/translations.es-419.js\":{\"newFeature\":\"NEW RELEASE\",\"heading\":\"Code-Free Websites\",\"subheading\":\"Template Kits are the easier, faster & flexible way to create WordPress websites.\",\"ctaText\":\"Discover Template Kits\"}}"
"{\"packages/elements-store

We submit a document to Lilt for translation with the following process:

  1. Create a document on Lilt and get the document_id from the response:
    POST https://lilt.com/2/documents/files
    LILT-API: {"project_id"=project_id,"name"="filename"}
    Content-Type: application/octet-stream
    
  2. Wait for the document import to complete (until the response indicates that import_in_progress is false):
### Keybase proof
I hereby claim:
* I am simonexmachina on github.
* I am simonexmachina (https://keybase.io/simonexmachina) on keybase.
* I have a public key ASBa1zVtAXZuy9wBN3OSRPQxYqgByvm7qUo_TN0vKfhiLAo
To claim this, I am signing this object: