Skip to content

Instantly share code, notes, and snippets.

@JasonStoltz
JasonStoltz / gist:7d7f6755b7b6e035bb04
Last active August 29, 2015 14:18
Angular recursive scope find
(function(){
var root = angular.element(document.body).injector().get('$rootScope');
function children(scope) {
var arr = [];
var head = scope.$$childHead;
if (head) {
arr.push(head);
ir = head.$$nextSibling;
while(ir) {

Scala

This is the model heirarchy i had envision in scala..

/* Anything that is an epixa resource */
trait ResourceLike {
  val $promise
  def $reload
  ...
}
@JasonStoltz
JasonStoltz / Patterns.md
Last active January 17, 2017 20:29
React Patterns

React and Redux patterns

Topics:

  • Smart and Dumb components
  • Stateless Functional components
  • Pure Components
  • Redux
  • Containers and Components
  • mapStateToProps and mapDispatchToProps
  • Selectors
@JasonStoltz
JasonStoltz / Talk.md
Last active August 7, 2017 17:48
Analyzing Web Performance

Analyzing Web Performance

Overview

Web performance === How fast a web site loads

There are many factors, which affect web site performance:

  • Servers and infrastructure (How fast is your hardware)
  • Backend queries and code
  • Networks (manged DNS - Dyn, Akamai network)
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.3'
@JasonStoltz
JasonStoltz / Talk.md
Last active September 18, 2017 16:58
Concept Print L&L
@JasonStoltz
JasonStoltz / jquery-autocomplete.html
Last active August 30, 2018 12:20
App Search Autocomplete Examples
<html>
<!--
This example demonstrates Swiftype's App Search using a jQuery based
auto-complete library, https://github.com/devbridge/jQuery-Autocomplete.
-->
<head>
<style>
body {
display: flex;
@JasonStoltz
JasonStoltz / debounce.js
Created January 15, 2019 18:11
Debounce 1 tick
const debounce = (() => {
let wasCalled = false;
let fn = null;
return newFn => {
fn = newFn;
if (!wasCalled) {
wasCalled = true;
setTimeout(() => {
@JasonStoltz
JasonStoltz / App.jsx
Created January 28, 2019 21:50
StickyFacets
<StickyFacets>
{({ facets }) => (
<React.Fragment>
<Facet
facets={facets}
field="date_established"
label="Date Established"
view={SingleRangeSelectFacet}
/>
<Facet
@JasonStoltz
JasonStoltz / App.jsx
Last active February 1, 2019 19:53
BooleanFacet Example
import React from "react";
import AppSearchAPIConnector from "@elastic/search-ui-app-search-connector";
import {
Facet,
SearchProvider,
SearchBox,
Results,
PagingInfo,
ResultsPerPage,
Paging