Skip to content

Instantly share code, notes, and snippets.

View christ776's full-sized avatar

Christian De Martino christ776

View GitHub Profile
@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,

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

@learncodeacademy
learncodeacademy / generators.md
Last active January 7, 2024 11:58
What are Javascript Generators?

##what are generators##

  • They're pausable functions, pausable iterable functions, to be more precise
  • They're defined with the *
  • every time you yield a value, the function pauses until .next(modifiedYieldValue) is called
var myGen = function*() {
  var one = yield 1;
  var two = yield 2;
  var three = yield 3;
 console.log(one, two, three);
@kristopherjohnson
kristopherjohnson / KeyboardNotification.swift
Last active October 6, 2023 14:45
Swift convenience wrapper for the userInfo values associated with a UIKeyboard notification
import UIKit
/// Wrapper for the NSNotification userInfo values associated with a keyboard notification.
///
/// It provides properties that retrieve userInfo dictionary values with these keys:
///
/// - UIKeyboardFrameBeginUserInfoKey
/// - UIKeyboardFrameEndUserInfoKey
/// - UIKeyboardAnimationDurationUserInfoKey
/// - UIKeyboardAnimationCurveUserInfoKey
@vladignatyev
vladignatyev / progress.py
Last active March 31, 2024 22:54
Python command line progress bar in less than 10 lines of code.
# The MIT License (MIT)
# Copyright (c) 2016 Vladimir Ignatev
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the Software
# is furnished to do so, subject to the following conditions:
#
@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:
@calt
calt / Tabbar.Swift
Last active January 9, 2024 05:58
UITabBar with custom height in Swift, does not work for iOS 14 or later.
// Does not work on iOS 14.0 or later, keeping the gist just for reference.
extension UITabBar {
override open func sizeThatFits(size: CGSize) -> CGSize {
super.sizeThatFits(size)
var sizeThatFits = super.sizeThatFits(size)
sizeThatFits.height = 71
return sizeThatFits
}
}
@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
@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
@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