Skip to content

Instantly share code, notes, and snippets.

View thomasdegry's full-sized avatar
🍾
Popping off

Thomas Degry thomasdegry

🍾
Popping off
View GitHub Profile
@klaaspieter
klaaspieter / Calendar.swift
Last active July 10, 2017 09:21
Calendar extension to determine wether a date is after today
import Foundation
extension Calendar {
/// Returns `true` if the given date is after today, as defined by the calendar and calendar's locale.
///
/// Because it's impossible to define the end of a day (there are an infinite number of
/// milliseconds between 23:59:59 and 00:00:00), this method instead ensures that
/// `date` >= `startOfTomorrow`.
///
/// - parameter date: The specified date.
@bendc
bendc / easing.css
Created September 23, 2016 04:12
Easing CSS variables
:root {
--ease-in-quad: cubic-bezier(.55, .085, .68, .53);
--ease-in-cubic: cubic-bezier(.550, .055, .675, .19);
--ease-in-quart: cubic-bezier(.895, .03, .685, .22);
--ease-in-quint: cubic-bezier(.755, .05, .855, .06);
--ease-in-expo: cubic-bezier(.95, .05, .795, .035);
--ease-in-circ: cubic-bezier(.6, .04, .98, .335);
--ease-out-quad: cubic-bezier(.25, .46, .45, .94);
--ease-out-cubic: cubic-bezier(.215, .61, .355, 1);
@samsonjs
samsonjs / PSPDFUIKitMainThreadGuard.m
Created July 3, 2016 00:40 — forked from steipete/PSPDFUIKitMainThreadGuard.m
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.You might n…
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
#import <UIKit/UIKit.h>
#import <objc/runtime.h>
#import <objc/message.h>
@t-mart
t-mart / netrw quick reference.md
Last active July 25, 2024 13:56
A quick reference for Vim's built-in netrw file selector.
Map Action
<F1> Causes Netrw to issue help
<cr> Netrw will enter the directory or read the file
<del> Netrw will attempt to remove the file/directory
- Makes Netrw go up one directory
a Toggles between normal display, hiding (suppress display of files matching g:netrw_list_hide) showing (display only files which match g:netrw_list_hide)
c Make browsing directory the current directory
C Setting the editing window
d Make a directory
@paulirish
paulirish / what-forces-layout.md
Last active July 27, 2024 23:38
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@chantastic
chantastic / on-jsx.markdown
Last active May 30, 2024 13:11
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't

@mthongvanh
mthongvanh / UICollectionView Cell Sizing
Last active August 29, 2015 14:10
via #iosdev on freenode.net: User wanted the first and last column of a 7-Column collection view to be wider than the middle columns
// Intent: Create a 7-Column collection view where the first and last column are wider than the middle columns
// Solution: Via the UICollectionViewDeleateFlowLayout calculate the correct size of the cells
const NSUInteger daysInWeek = 7;
const CGFloat cellHeight = 54.f;
const CGFloat sizeRatioForWeekStartEnd = 0.20;
const CGFloat sizeRatioForMiddleDays = (1 - (2 * sizeRatioForWeekStartEnd)) / (daysInWeek - 2);
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
CGSize cellSize = CGSizeZero;
@soffes
soffes / Podfile
Created May 8, 2014 05:22
Pods used in Litely 1.0
platform :ios, '7.0'
# Core Data
pod 'SSDataKit', :git => 'https://github.com/soffes/SSDataKit', :commit => '60d432e734ae11e8cfedac8ac5f68c0ce8a1b9ba'
# On-disk & in-memory caching
pod 'SAMCache'
# Fast image view for Core Image
pod 'SAMCoreImageView', '0.1.3'
@rtt
rtt / tinder-api-documentation.md
Last active June 21, 2024 04:19
Tinder API Documentation

Tinder API documentation

Note: this was written in April/May 2014 and the API may has definitely changed since. I have nothing to do with Tinder, nor its API, and I do not offer any support for anything you may build on top of this. Proceed with caution

http://rsty.org/

I've sniffed most of the Tinder API to see how it works. You can use this to create bots (etc) very trivially. Some example python bot code is here -> https://gist.github.com/rtt/5a2e0cfa638c938cca59 (horribly quick and dirty, you've been warned!)

@scottburton11
scottburton11 / gist:10221751
Created April 9, 2014 02:50
Facebook RSVP using the JS SDK
<html>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '721489701236648',
status : true,
xfbml : true
});