Skip to content

Instantly share code, notes, and snippets.

import React, { useEffect, useState } from 'react'
import { animated, useSpring } from 'react-spring'
function useSpringWithRestPromise(options) {
let animation
const promise = new Promise((resolve, reject) => {
animation = useSpring({
...options,
onRest: () => options.onRest && options.onRest(resolve, reject)
})
@msaspence
msaspence / AnimateAutoHeight.jsx
Created July 9, 2020 10:42
Animate between two 'auto' heights
import React, { useCallback, useMemo, useState } from 'react'
import styled from 'react-emotion'
import ResizeObserver from 'react-resize-observer'
export default function AnimateAutoHeight({ children }) {
const [height, setHeight] = useState('auto')
const onResize = useCallback(
({ height: newHeight }) => setHeight(newHeight),
[setHeight]
)
### Keybase proof
I hereby claim:
* I am msaspence on github.
* I am msaspence (https://keybase.io/msaspence) on keybase.
* I have a public key whose fingerprint is CD5E AB92 0F33 E380 BA96 3B4E 3CEC 47D8 8BBF 0AFC
To claim this, I am signing this object:
"use strict";
if (global.Turbolinks === undefined) {
throw "Missing Turbolinks dependency. TurboReact requires Turbolinks be included before it.";
}
var HTMLtoJSX = require("htmltojsx");
var JSXTransformer = require("react-tools");
var React = require("react");
@msaspence
msaspence / gist:f82b8ae6356d9368a602
Created October 22, 2014 15:45
Automatic module for Roadie and ActionMailer
module Roadie
module ActionMailer
module Automatic
def mail(*args, &block)
super.tap do |email|
binding.pry
email.extend ::Roadie::Rails::InlineOnDelivery
email.roadie_options = roadie_options.try(:dup)
end
@msaspence
msaspence / gist:11032254
Created April 18, 2014 08:47
Chosen with absolute positioning
// Chosen, a Select Box Enhancer for jQuery and Prototype
// by Patrick Filler for Harvest, http://getharvest.com
//
// Version 0.9.15
// Full source at https://github.com/harvesthq/chosen
// Copyright (c) 2011 Harvest http://getharvest.com
// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
// This file is generated by `cake build`, do not edit it by hand.
(function() {
class Action < ActiveRecord::Base
include OpenGraph
include Activity
default_scope where(pending: false, archived: false)
scope :pending, where(pending: true, archived: false)
attr_accessible :title, :summary, :description, :user_id, :image, :fund_ceiling, :participation_target_count, :campaign_id, :cause_id, :featured, :poll_options, :poll_options_attributes, :pending, :archived, as: :admin
attr_accessible :title, :summary, :description, :image, :poll_options_attributes