Skip to content

Instantly share code, notes, and snippets.

View christ776's full-sized avatar

Christian De Martino christ776

View GitHub Profile

BDKCollectionIndexView

An index-title-scrubber-bar, for use with a UICollectionView (or even a PSTCollectionView). Gives a collection view the index title bar for -sectionIndexTitles that a UITableView gets for (almost) free. A huge thank you to @Yang from [this Stack Overflow post][so], which saved my bacon here.

The problem

When you're using a UITableView and you define the UITableViewDataSource method -sectionIndexTitlesForTableView:, you get a sweet right-hand-side view for scrubbing through a long table view of fields, separated by sections. The titles are the names of the sections, by default (or at least letters based on the section names).

UITableView with section index titles

@erica
erica / nametag.swift
Last active November 18, 2016 19:35
// NSObject Nametag
public var sharedNametagKey : UnsafeMutablePointer<UInt8> = UnsafeMutablePointer.alloc(1)
public extension NSObject {
public var nametag: String? {
get {
return objc_getAssociatedObject(self, &sharedNametagKey) as? String
}
set {
if let newNameTag = newValue {
// Store unwrapped new value
@wacko
wacko / instrucciones.md
Last active January 19, 2017 13:09 — forked from ceneon/gist:8222574
Recategorización de Monotributo

Para recategorizarte en el Monotributo, la aplicación de AFIP da error de Javascript por todos lados. A menos que entres con Internet Explorer...

Para hacer el trámite en Chrome, Firefox o cualquier browser decente:

  1. Ingresar a la AFIP (Acceso con Clave Fiscal)
  2. Ir a Sistema Registral
  3. Hacer click en la lupa
  4. Registro tributario > Monotributo
  5. Este es el 1er formulario que se rompe. Hay dos soluciones:
@mishagray
mishagray / FutureKit+AlamoFire.swift
Created January 14, 2016 05:31
FutureKit+AlamoFire.swift
//
// FutureKit+AlamoFire.swift
//
// Created by Michael Gray on 9/21/15.
//
import Foundation
import Alamofire
import FutureKit
##
## Supermodel
## A Sega Model 3 Arcade Emulator.
## Copyright 2011-2016 Bart Trzynadlowski, Nik Henson
##
## This file is part of Supermodel.
##
## Supermodel is free software: you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation, either version 3 of the License, or (at your option)
@phleagol
phleagol / binge
Created June 3, 2019 05:44
binge
#!/usr/bin/perl
##
## binge - curses torrent client with 'top' mode.
##
## keys - Press 'h' to show key bindings, then ESC.
##
## urxvt -name binge -n binge -T binge -e sh -c "exec binge 2>>/tmp/binge_$(date +%s).log"
##
## apt-install libcurses-perl libwww-perl libjson-maybexs-perl libjson-xs-perl libdata-dump-perl
## libmath-round-perl libtext-unidecode-perl transmission-daemon
@kreeger
kreeger / BDKCollectionIndexView.m
Created February 11, 2013 17:19
An index-title-scrubber-bar, for use with a UICollectionView (or even a PSTCollectionView). Gives a collection view the index title bar that a UITableView gets for (almost) free. A huge thank you to @yang from http://stackoverflow.com/a/14443540/194869, which saved my bacon here.
/*
* BDKCollectionIndexView.h
*/
#import <UIKit/UIKit.h>
/** The direction in which the control is oriented. Assists in determining layout values.
*/
typedef enum {
BDKCollectionIndexViewDirectionVertical = 0,
@jonathanws
jonathanws / mocking-with-sinon-sandbox.js
Last active October 5, 2021 19:41
Testing AWS services with Sinon mocks in Lambda
/**
* Writing tests for functions that use external dependencies is tough.
* We can get past this by using sinon sandboxes to temporarily overwrite the
* prototypes of those dependencies, just for testing
*
* Before running these tests run:
* $ npm install --save-dev aws-sdk sinon mocha
*/
/**
@AliSoftware
AliSoftware / Coordinator.swift
Last active July 10, 2022 14:32
Coordinators & StateMachine - Concept
struct Coordinator {
let window: UIWindow
let navCtrl: UINavigationController?
func start() {
presentWelcomeScreen()
}
private func presentWelcomeScreen() {
let vc = WelcomeScreenViewController() // Instanciate from code, XIB, Storyboard, whatever your jam is
@mackuba
mackuba / wwdc15.md
Last active August 6, 2022 17:28
New stuff from WWDC 2015

Here's my own list of the interesting stuff announced during this year's WWDC, collected from the keynotes, various Apple docs, blog posts and tweets.

If you're planning to watch the videos, I really recommend this Mac app that helps you download and watch them: https://github.com/insidegui/WWDC.

OS X El Capitan

http://www.apple.com/osx/elcapitan-preview/

  • split view - two apps side by side on full screen