Skip to content

Instantly share code, notes, and snippets.

Simon Ljungberg simme

Block or report user

Report or block simme

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View goroutines.swift
import Foundation
protocol Channel: IteratorProtocol {
func send(_ value: Element?)
/// A blocking channel for sending values.
/// `send` and `receive` must run in separate separate execution contexts, otherwise you get a deadlock.
final class BlockingChannel<A>: Channel {
smileyborg / InteractiveTransitionTableViewDeselection.m
Last active Dec 16, 2019
Animate table view deselection alongside interactive transition on iOS 11
View InteractiveTransitionTableViewDeselection.m
In iOS 11, interactive view controller transitions no longer scrub by setting the layer speed to zero
and changing the timeOffset. As a result of this change, implicit animations that occur in places like
-viewWillAppear: (called during an interactive transition) no longer end up “caught in” the animation.
To get the same behavior for table view row deselection as before, you can either use UITableViewController
which implements this for you, or you can implement it manually by deselecting the row in an alongside
animation for the transition (set up in -viewWillAppear: using the transition coordinator).
Here is an example implementation which correctly handles some of the more subtle corner cases:
westerlund /
Created May 25, 2017 — forked from originell/
This is a straight copy of – to avoid this ever going dark

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
nolanlawson / protips.js
Last active Mar 22, 2020
Promise protips - stuff I wish I had known when I started with Promises
View protips.js
// Promise.all is good for executing many promises at once
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
cybear /
Created Mar 10, 2015
Writing tips for error messages

Writing tips for error messages

  • Describe the cause of the error, if possible.
  • Avoid blaming the user. "You typed a URL that doesn't exist" => "We can't find any page at this URL"
  • Avoid impersonal writing. "Could not upload selected files" => "We could not upload the files that you selected"
  • Suggest a next action for the user if it is plausible.

Hello, visitors! If you want an updated version of this styleguide in repo form with tons of real-life examples… check out Trellisheets!

Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

View logo.js
var red = '#c00'
var white = '#fff'
console.log('<table border=0 cellspacing=0 cellpadding=0 style="line-height:10px">\n' + ([
'1 1 1 1',
'1 1 1 1 1 1 1 1',
'1 1 1 1 1 1 1 1',
'1 1 1 1 1 1 1',
'111111 1111111111',
simme / app.js
Last active May 16, 2019
Gulp file for an Ember project using bower and browserify.
View app.js
// Load Ember into the global scope by requiring it
// Go have fun
var app = Ember.Application.create();
View app.js {
this.resource('post', { path: '/posts/:post_id' });
App.PostRoute = Ember.Route.extend({
model: function(params) {
return'post', params.post_id);


Clone and build Node for analysis:

$ git clone
$ cd node
$ export GYP_DEFINES="v8_enable_disassembler=1"
$ ./configure
$ make -j4
You can’t perform that action at this time.