Skip to content

Instantly share code, notes, and snippets.

View phylliswong's full-sized avatar
💭
coding 👩🏻‍💻

Phyllis Wong phylliswong

💭
coding 👩🏻‍💻
  • San Francisco Bay Area
View GitHub Profile
@phylliswong
phylliswong / Square.js
Last active December 11, 2018 22:39
simple square component for tutorial example
import React from 'react';
const Square = () => {
const sqStyle = {
"border": "1px solid black",
"color": "#a9a9a9"
}
return (
<div className='sq-container' style={sqStyle}>
@phylliswong
phylliswong / Square.js
Last active December 12, 2018 00:06
Square with CSS stylesheet
import React, { Component } from 'react';
import './Square2.css';
class Square extends Component {
render () {
return (
<div className='sq2-container'>
<h1 className='sq2-title'>Even better title</h1>
<p className='sq-content'>Much improved content</p>
</div>
@phylliswong
phylliswong / ProgressBar.js
Created December 13, 2018 00:45
Simple progress bar component with inline style
import React from 'react'
// ES6 JS object
const containerStyle = {
'position': 'relative',
'height': '20px',
'width': '350px',
'border-radius': '350px',
'border': '1px solid #333'
};
@phylliswong
phylliswong / shopsTableView.swift
Created February 8, 2019 20:46
shopsTableview
extension ShopsViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let selectedShop = fetchedResultsController.object(at: indexPath)
let st = UIStoryboardname: "Main", bundle: Bundle.main)
let vc = st.instantiateViewController(withIdentifier: "EmployeeViewController") as! EmployeeViewController
vc.shop = selectedShop
self.navigationController?.pushViewController(vc, animated: true)
}
<script>
// app ID
var intercomSettings = {
app_id: "r0j5pbsv"
};
// Verifies and cleans all GTM variables
function pushGTMVariablesToIntercom(gtmKey, gtmValue) {
if(gtmValue != null && gtmValue != "" && gtmValue != "undefined") {
if(typeof gtmValue == "string") {
import Foundation
public class LRUCache<KeyType: Hashable> {
private let maxSize: Int
private var cache: [KeyType: Any] = [:]
private var priority: LinkedList<KeyType> = LinkedList<KeyType>()
private var key2node: [KeyType: LinkedList<KeyType>.LinkedListNode<KeyType>] = [:]
public init(_ maxSize: Int) {
self.maxSize = maxSize
public func get<T>(key: String, defaultValue: T) -> Any {
let group = DispatchGroup()
var allocations = [JSON]()
var value = [JSON]()
if (futureAllocations == nil) { return defaultValue }
// This needs to be a blocking operation
let _ = self.futureAllocations?.done { (jsonArray) in
allocations = jsonArray
module.exports = function() {
var authenticated = window.localStorage.getItem('auth_token');
if (authenticated){
evolv.context.update({'auth':'true'})
} else {
evolv.context.update({'auth':'false'})
}
};
@phylliswong
phylliswong / index.js
Last active April 14, 2021 00:18
TruGreen Click to Call
module.exports = function() {
var url = window.location.href;
var nodes = document.querySelectorAll('[href^="tel"]');
var callBtns = Array.prototype.slice.call(nodes);
callBtns.forEach(function(btn) {
btn.addEventListener('click', function() {
evolv.client.emit('tap_to_call.clicked');
})
})
@phylliswong
phylliswong / index.js
Last active April 14, 2021 21:43
TruGreen GA Integration
module.exports = function () {
var Evolv=function(t){"use strict";var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,i)};function i(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var n=function(){function t(t){void 0===t&&(t=5e3),this.maxWaitTime=t,this.queue=[],this.interval=50,this.activeCandidateEvents={confirmed:{},contaminated:{}},this.contaminations={},this.waitForAnalytics(),this.waitForEvolv(this.configureListeners.bind(this))}return t.prototype.configureListeners=function(){var t=this;window.evolv.client.on("confirmed",(function(e){t.sendMetricsForActiveCandidates(e)})),window.evolv.client.on("contaminated",(function(e){t.sendMetricsForActiveCandidates(e)})),window.evolv.client.on("event.emitted",(function(e,i){t.sendMetrics(i,{uid:window.evolv.context.uid})}))},t.prototype.sendMetricsForActiveCandidates=f