Skip to content

Instantly share code, notes, and snippets.

@laszlotuss
laszlotuss / AdaptiveStack.swift
Last active February 20, 2024 19:07
AdaptiveStack
import SwiftUI
struct AdaptiveStack<Content: View>: View {
@Environment(\.horizontalSizeClass) var sizeClass
let horizontalAlignment: HorizontalAlignment
let verticalAlignment: VerticalAlignment
let spacing: CGFloat?
let isVertical: Bool?
let content: () -> Content
Mix.install([:mint, :castore])
defmodule Main do
def run() do
total =
Stream.resource(
fn ->
{:ok, conn} = Mint.HTTP.connect(:https, "ftp.bit.nl", 443, mode: :passive)
{:ok, conn, _ref} = Mint.HTTP.request(conn, "GET", "/speedtest/10mb.bin", [], nil)
{conn, true}
export const chaosTestStrings = (): void => {
const textNodes = getAllTextNodes(document.body);
for (const node of textNodes) {
const textNodeLength = node.textContent ? node.textContent.length : 0;
if (node.textContent === null) {
return;
}
if (node.parentElement instanceof Element) {
if (node.parentElement.dataset.originalText === undefined) {
@baumandm
baumandm / Chakra-UI x React-datepicker.md
Last active May 29, 2024 05:29
Chakra-UI x React-datepicker

⚠️ I'd recommend using this fork by @igoro00 which has better theme support.


Tiny wrapper component for React-Datepicker to stylistically fit with Chakra-UI 1.x.

<DatePicker selectedDate={myDate} onChange={(d) => console.log(d)} />
@inamiy
inamiy / SwiftElmFrameworkList.md
Last active March 11, 2024 10:20
React & Elm inspired frameworks in Swift
@psobot
psobot / bouncer.py
Last active June 8, 2023 02:42
Logic Pro X Project Bounce script
import os
import sys
import time
import atomac
import subprocess
if len(sys.argv) < 2:
print "Usage: bouncer.py <path_to_logic_project> (<path_to_logic_project>)"
os.exit(1)
@spoike
spoike / framerateThrottle.js
Last active August 13, 2017 21:35
Throttling using windows.requestAnimationFrame with fallback to lodash throttle. See more here: http://spoike.ghost.io/user-input-framerate-throttling-in-the-browser/
(function() {
var defaultFrameRate = 20, // fps lock for old browsers
// This is the default fallback throttle function
framerateThrottle = function(callback) {
return _.throttle(callback, 1 / (defaultFrameRate * 1000));
};
// Feature detection - should have requestAnimationFrame
if (window.requestAnimationFrame) {
framerateThrottle = function(callback) {
@originell
originell / RubberBand.md
Last active April 4, 2024 00:26
This is a straight copy of – to avoid this ever going dark http://squareb.wordpress.com/2013/01/06/31/

Analysis of Apple’s rubber band scrolling

January 6, 2013

I recently saw a post on Twitter from @chpwn that described the alogorithm that Apple uses for its “rubber band” or “bungee” scrolling.

b = (1.0 – (1.0 / ((x * c / d) + 1.0))) * d