Skip to content

Instantly share code, notes, and snippets.

@imjamescrain
imjamescrain / confetti.js
Last active December 15, 2023 06:59
Re-write of Shopify's -> Arrive's Confetti in Reanimated v2
import React, { useEffect } from "react";
import Animated, { FadeOut, withDelay, withTiming, useSharedValue, useAnimatedStyle, cancelAnimation } from "react-native-reanimated";
import PropTypes from "prop-types";
import { Dimensions, StyleSheet } from "react-native";
import FastImage from "react-native-fast-image";
import ConfettiImage from "../../../assets/img/confetti.png";
const NUM_CONFETTI = 100;
const COLORS = ["#31ECBC", "#E0DAFE", "#6345F9"];
const CONFETTI_SIZE = 16;
@monfera
monfera / .block
Last active March 5, 2018 10:37
SVG heat shimmer
license: mit
border: no
height: 420
@mattt
mattt / uiappearance-selector.md
Last active September 24, 2024 12:59
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 3

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
 sed 's/UI_APPEARANCE_SELECTOR//g' | \
@danieleli
danieleli / ko-projected-observable.js
Created December 24, 2011 21:33
Knockout Protected Observables
//http://www.knockmeout.net/2011/03/guard-your-model-accept-or-cancel-edits.html
//wrapper to an observable that requires accept/cancel
$(function () {
ko.protectedObservable = function (initialValue) {
var result, _actualValue, _tempValue;
if (initialValue && typeof (initialValue) === "string" && initialValue.indexOf("/Date(") === 0) {
initialValue = new Date(parseInt(initialValue.match(/\d+/))).toString();
}
_actualValue = ko.observable(initialValue);