Skip to content

Instantly share code, notes, and snippets.

View daino3's full-sized avatar

Dain Hall daino3

  • SpotOn, Inc
  • Chicago, Il
View GitHub Profile
@daino3
daino3 / Vagrant
Last active July 26, 2018 17:22
s3 vagrant images
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# name of virtualbox
config.vm.provider :virtualbox do |vb|
@daino3
daino3 / rebuild_vm
Last active November 9, 2018 19:52
#!/bin/sh
BOXNAME=`date +'vm_box_%m%d%Y_%H%M%S'`
vagrant destroy --force || exit $?
PACKAGING_BASE_BOX=1 vagrant up || exit $?
PACKAGING_BASE_BOX=1 vagrant package --out "$BOXNAME.box" || exit $?
vagrant box add $BOXNAME "./$BOXNAME.box" || exit $?
aws s3 cp "$BOXNAME.box" "s3://vagrant-boxes/" || exit $?
document.addEventListener('scroll', this.onScroll);
function onScroll() {
const offSet = this.getOffset();
const midScreen = window.innerHeight / 2;
let opacity = 1;
// element is in viewport
if (Math.abs(offSet) < midScreen) {
// *pow to amplify opacity
defmodule WebsocketApi.MerchantLocationChannel do
use WebsocketApi.Web, :channel
alias WebsocketApi.{
DeviceWatcher,
MerchantLocation,
MerchantLocationDevice,
Repo
}
require Logger
@moduledoc false
class Sidebar extends React.Component {
// this class will be responsible
// for positioning, styles, animations, etc.
// and that's about it...
render() {
const {
isOpen,
children,
} = this.props
return (
@daino3
daino3 / cohort.sql
Last active January 26, 2020 03:16
-- COHORT ANALYSIS
-- (merchant_location_id, cohort_month), each
with cohort_items as (
select
date_trunc('month', ML.created_at)::date as cohort_month,
id as merchant_location_id
from merchant_locations ML
),
-- (merchant_location_id, month_number): merchant X has activity in month number X
merchant_appointments as (
import React from 'react';
import { useSpring, animated } from 'react-spring';
import { useDrag } from 'react-use-gesture';
import PropTypes from 'prop-types';
const THRESHOLD_PX = 100;
function AnimatedSwipeNavigation({ onSwipeLeft, onSwipeRight, vertical = false, horizontal = true, children }) {
const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }));