Skip to content

Instantly share code, notes, and snippets.

View simonexmachina's full-sized avatar

Simon Wade simonexmachina

  • Melbourne, Australia
View GitHub Profile
@simonexmachina
simonexmachina / post.md
Created May 8, 2014 23:17
JavaScript and Object Models

JavaScript and Object Models

A "choose your own adventure" story

JavaScript is has both object-oriented and functional heritage, thanks to its two parents: Scheme and Self.

It provides first class functions and makes it simple to compose these function objects into bundles of awesome. Even though I'm an OO "true believer" at heart, I find myself composing my code using functional concepts, and use the OO approach where there's a clear benefit or where I feel that it's the best way to communicate the interface.

Object-oriented software design is by no means the only way to do software design, but it's been an immensely successful model for a very long time now, and provides a clear and well-understood mental model for thinking and communicating about software. Lots of good ideas like encapsulation, delegation, traits and composition fit well into OO design.

### 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:

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):
@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
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()) {
export default {
pageTitle: "Hello! World",
metaDescription: "Batman",
topArticle: <div></div>
}

Keybase proof

I hereby claim:

  • I am simonexmachina on github.
  • I am aexmachina (https://keybase.io/aexmachina) on keybase.
  • I have a public key whose fingerprint is C99E 8EA3 9A10 90C7 5D71 6D67 D63F 6167 31A6 C4BD

To claim this, I am signing this object:

@simonexmachina
simonexmachina / .gitignore
Last active October 24, 2019 05:44
Example .gitignore file for iOS projects
## Build generated
build/
DerivedData
build.xcarchive
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
diff --git a/client/shared/components/filterList/filterList.js b/client/shared/components/filterList/filterList.js
index a2c459d9..203332fe 100644
--- a/client/shared/components/filterList/filterList.js
+++ b/client/shared/components/filterList/filterList.js
@@ -79,9 +79,7 @@ const FilterList = ({ FilterItem, parsedLocation, param, className }) => {
const maxParamFormatValue = filterParamsConfig[param].format
? filterParamsConfig[param].format(maxParamValue)
: maxParamValue
- const priceDisplayName = `${minParamFormatValue} - ${
- maxParamFormatValue