Skip to content

Instantly share code, notes, and snippets.

// MARK: - FlowLayout
private class FlowLayout: UICollectionViewFlowLayout, WaterfullFlowLayout {
var preparedLayoutAttributes: [UICollectionViewLayoutAttributes] = []
override init() {
super.init()
callInit()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
@staltz
staltz / introrx.md
Last active November 19, 2024 09:32
The introduction to Reactive Programming you've been missing
@brly
brly / gist:37c44f51a7908730c161
Created June 22, 2014 17:46
martini json response sample
package main
import (
"github.com/go-martini/martini"
"github.com/martini-contrib/render"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"net/http"
)
#!/bin/bash
if [ $# -lt 2 ]; then
echo "format: git_cleanup <repo name> [-x/--expunge <directory 1> -l/--keeplatest <directory 2> ...]"
exit
fi
PROJ="$1"
shift
@oseau
oseau / Karabiner
Last active April 19, 2018 03:57
hhkb controller
<?xml version="1.0"?>
<root>
<item>
<name>Shifts to Parentheses</name>
<appendix>Shifts, when pressed alone, type parentheses. When used with other keys they're normal shifts.</appendix>
<identifier>private.shifts_to_parens</identifier>
<!-- This is the basic mapping. -->
<autogen>--KeyOverlaidModifier-- KeyCode::SHIFT_R, ModifierFlag::SHIFT_R | ModifierFlag::NONE, KeyCode::SHIFT_R, KeyCode::MINUS, ModifierFlag::NONE</autogen>
@d-ronnqvist
d-ronnqvist / Thoughts on removedOnCompletion in SparkRecordingCircle.md
Last active May 16, 2020 02:51
What I think is wrong with the Spark Recording Circle code and why

There was [a tweet][tweetSoto] a couple of days ago that resulted in a discussion/question about what it wrong with the usage of removedOnCompletion = NO in the [SparkRecordingCircle code][code] for that [Subjective-C post][post].

We all kept saying that the explanation doesn't fit in a tweet, so here is my rough explanation about the issues.

But, let me first say that I think that the Subjective-C articles are reallt cool and useful to learn from. This is trying to reason about the general usage of removedOnCompletion = NO, using that code as an example, since that was what was discussed on twitter.


The root problem, as [Nacho Soto pointed out][rootProblem], is that removedOnCompletion = NO in combination with fillMode = kCAFillModeForwards is almost always used when you are not updating the model layer. This means that after the animation has finished, what you see on screen is not reflected in the property of the layer. The biggest issue that this can cause is that all the

package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"net/url"
"os/exec"
"strconv"
package main
import (
"github.com/codegangsta/martini"
"github.com/martini-contrib/binding"
"github.com/martini-contrib/encoder"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"net/http"
"time"
@aufflick
aufflick / .lldbinit
Created February 12, 2014 00:03
my Reveal lldb setup, based on @orj and @chrismiles efforts
command script import /opt/lldb-scripts/reveal.py
command alias interface_inspector p (BOOL)[[NSBundle bundleWithPath:@"/Applications/Interface Inspector.app/Contents/Resources/InterfaceInspectorRemote.framework"] load]
command alias reveal_load_sim expr (void*)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib", 0x2);
command alias reveal_load_dev expr (void*)dlopen([(NSString*)[(NSBundle*)[NSBundle mainBundle] pathForResource:@"libReveal" ofType:@"dylib"] cStringUsingEncoding:0x4], 0x2);
command alias reveal_start expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:nil];
command alias reveal_stop expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStop" object:nil];
@mattt
mattt / Emoji.plist
Created December 30, 2013 17:26
Emoji grouped by category, as extracted by by private APIs on the iPhone simulator, via [Cédric Luthi](https://github.com/0xced).
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>People</key>
<array>
<string>😄</string>
<string>😃</string>
<string>😀</string>
<string>😊</string>