Skip to content

Instantly share code, notes, and snippets.

View timkendall's full-sized avatar

Tim Kendall timkendall

  • Acorns
  • Orange, CA
View GitHub Profile
@stevekane
stevekane / gist:6356006
Created August 27, 2013 16:44
ClickElsewhereMixin (an Ember mixin used to detect clicks outside a view) Original Attribution: Alex Speller's gist at https://gist.github.com/alexspeller/6251054
#original attribution https://gist.github.com/alexspeller/6251054
bound = (fnName) -> Ember.computed fnName -> @get(fnName).bind(@)
App.ClickElsewhereMixin = Ember.Mixin.create
#use this method hook to define your desired behavior
onClickElsewhere: Ember.K
#bound version of our instance method
@kentcdodds
kentcdodds / esnextbin.md
Created December 21, 2016 05:54
esnextbin sketch
@bennadel
bennadel / preload-images.htm
Created March 27, 2014 11:55
Preloading Images In AngularJS With Promises
<!doctype html>
<html ng-app="Demo">
<head>
<meta charset="utf-8" />
<title>
Preloading Images In AngularJS With Promises
</title>
</head>
<body ng-controller="AppController">
@paulkaplan
paulkaplan / retina_fabric.js
Created July 21, 2013 22:47
Getting fabric.js to work with Retina screens
if( window.devicePixelRatio !== 1 ){
var c = canvas.getElement(); // canvas = fabric.Canvas
var w = c.width, h = c.height;
// Scale the canvas up by two for retina
// just like for an image
c.setAttribute('width', w*window.devicePixelRatio);
c.setAttribute('height', h*window.devicePixelRatio);
@madrobby
madrobby / gist:1362093
Created November 13, 2011 13:04
Force rendering a DOM element when Webkit is acting up
forceRerenderOnWebkit: ->
@el.parentNode.style.cssText += ';-webkit-transform:rotateZ(0deg)'
@el.parentNode.offsetHeight
@el.parentNode.style.cssText += ';-webkit-transform:none'
@jbaxleyiii
jbaxleyiii / test.js
Created November 15, 2016 19:43
react-apollo testing
import { Component } from "react";
import { print } from "graphql-tag/printer";
import { graphql } from "react-apollo";
import { MockedProvider } from "react-apollo/test-utils";
import { addTypenameToDocument } from "apollo-client/queries/queryTransform";
import { mount } from "enzyme";
import { withSavedPayments, SAVED_ACCTS_QUERY } from "../";
@Yogu
Yogu / socket-keeper.ts
Last active March 19, 2020 23:51
max-age for keep-alive in node
import { injectable } from 'inversify';
import { Logger } from 'log4js';
import { Socket } from 'net';
import Timer = NodeJS.Timer;
export interface KeepaliveOptions {
/**
* The maximum time in milliseconds an unused socket will be kept alive before it will be closed
*
* This should be set to a smaller value than the server's keepalive timeout to avoid a race condition
@Jxck
Jxck / map.js
Last active April 10, 2020 03:36
Hadoop Streaming with Node.js
#!/usr/bin/env node
var stdin = process.openStdin();
var stdout = process.stdout;
var input = '';
stdin.setEncoding('utf8');
stdin.on('data', function(data) {
if (data) {
input += data;
@bengfarrell
bengfarrell / randomcoords.cpp
Last active April 17, 2020 16:30
Random Coordinates C++ Node.JS AddOn
#include <node.h>
#include <v8.h>
#include <stdio.h>
#include <stdlib.h>
using namespace v8;
Handle<Value> getRandomCoords2D(const Arguments& args) {
HandleScope scope;
@larahogan
larahogan / app-perf.md
Last active May 7, 2021 01:18
Native app performance metrics

Native app performance metrics

This is a draft list of what we're thinking about measuring in Etsy's native apps.

Currently we're looking at how to measure these things with Espresso and Kif (or if each metric is even possible to measure in an automated way). We'd like to build internal dashboards and alerts around regressions in these metrics using automated tests. In the future, we'll want to measure most of these things with RUM too.

Overall app metrics

  • App launch time - how long does it take between tapping the icon and being able to interact with the app?
  • Time to complete critical flows - using automated testing, how long does it take a user to finish the checkout flow, etc.?
  • Battery usage, including radio usage and GPS usage
  • Peak memory allocation