Skip to content

Instantly share code, notes, and snippets.

View smanikandan14's full-sized avatar

Mani smanikandan14

View GitHub Profile
@douglashill
douglashill / KeyboardScrollView.swift
Last active May 6, 2021 00:47
A UIScrollView subclass that allows scrolling using a hardware keyboard like NSScrollView. Supports arrow keys, option + arrow keys, command + arrow keys, space bar, page up, page down, home and end.
// Douglas Hill, November 2019
// Find the latest version of this file at https://github.com/douglashill/KeyboardKit
import UIKit
/// A scroll view that allows scrolling using a hardware keyboard like `NSScrollView`.
/// Supports arrow keys, option + arrow keys, command + arrow keys, space bar, page up, page down, home and end.
/// Limitations:
/// - Paging scroll views (isPagingEnabled = true) are not supported yet.
/// - The scroll view must become its own delegate so setting the delegate is not supported yet.
@douglashill
douglashill / KeyboardTableView.swift
Last active March 30, 2023 22:01
A UITableView that allows navigation and selection using a hardware keyboard.
// Douglas Hill, December 2018
// Made for https://douglashill.co/reading-app/
// Find the latest version of this file at https://github.com/douglashill/KeyboardKit
import UIKit
/// A table view that allows navigation and selection using a hardware keyboard.
/// Only supports a single section.
class KeyboardTableView: UITableView {
// These properties may be set or overridden to provide discoverability titles for key commands.
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active April 7, 2024 22:55
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@andymatuschak
andymatuschak / States-v3.md
Last active April 12, 2024 16:06
A composable pattern for pure state machines with effects (draft v3)

A composable pattern for pure state machines with effects

State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?

There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.

Here I present a composable pattern for pure state machiness with effects,

@nickbutcher
nickbutcher / 10: animator-morph_ridge_2_to_tick.xml
Last active February 20, 2021 07:32
Demonstrating an animation for scanning a fingerprint and showing success or failure. This uses a number of AnimatedVectorDrawables (https://developer.android.com/reference/android/graphics/drawable/AnimatedVectorDrawable.html) to 'morph' parts of the fingerprint into the tick or cross to report success or failure. It also uses a moving clip-pat…
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@ph0b
ph0b / build.gradle
Last active February 12, 2023 07:45
sample build.gradle for generating split APKs per ABI
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig{
minSdkVersion 14
targetSdkVersion 21
versionCode 101
@mohlendo
mohlendo / ReorderRecyclerView.java
Created November 26, 2014 14:05
A RecylcerView that can be reordered with drag&drop. Heavily inspired by https://www.youtube.com/watch?v=_BZIvjMgH-Q A complete example can be found here: https://github.com/mohlendo/ReorderRecyclerView
/*
* Copyright (C) 2014 I.C.N.H GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software