Skip to content

Instantly share code, notes, and snippets.

@rbobbins
rbobbins / protocols.md
Last active June 11, 2024 22:11
Notes from "Protocol-Oriented Programming in Swift"

PS: If you liked this talk or like this concept, let's chat about iOS development at Stitch Fix! #shamelessplug

Protocol-Oriented Programming in Swift

Speaker: David Abrahams. (Tech lead for Swift standard library)

  • "Crusty" is an old-school programmer who doesn't trust IDE's, debuggers, programming fads. He's cynical, grumpy.

  • OOP has been around since the 1970's. It's not actually new.

  • Classes are Awesome

    • Encapsulation
    • Access control
@JaviLorbada
JaviLorbada / FRP iOS Learning resources.md
Last active April 20, 2025 21:15
The best FRP iOS resources.

Videos

@niw
niw / UITextFieldLimitLengthDelegate.m
Last active July 1, 2019 16:53
The right solution to limit length of a text field.
/*
Why not simply use textField:shouldChangeCharactersInRange:replacementString:?
===
If you google how to limit a length of text field, you'll see many implementations simply using textField:shouldChangeCharactersInRange:replacementString: like
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
return [[textField.text stringByReplacingCharactersInRange:range withString:string] length] <= MAX_LENGTH;
@oliverfoggin
oliverfoggin / viewWithTextIn.m
Last active March 9, 2016 06:53
How to centre text using drawInRect...
//Create the rect you would like your text to be inside of...
CGRect maxTextRect = CGRectMake(0, 0, 200, 60);
//Create the attributed string
NSAttributedString *theString = //... do all the setup.
//Find the rect that the string will draw into **inside the maxTextRect**
CGRect actualRect = [theString boundingRectWithSize:maxTextRect.size options:NSStringDrawingUsesLineFragmentOrigin context:nil];
//Offset the actual rect inside the maxTextRect
@p2
p2 / csv-to-sqlite.py
Created December 4, 2013 23:35
Quickly create a SQLite table from a CSV/TSV file
#!/usr/bin/python
#
# Read a CSV/TSV with a header row (!) and put it into a new sqlite table
import sys
import csv
import sqlite3
class Importer (object):
@luw2007
luw2007 / 词性标记.md
Last active December 30, 2024 12:48
词性标记: 包含 ICTPOS3.0词性标记集、ICTCLAS 汉语词性标注集、jieba 字典中出现的词性、simhash 中可以忽略的部分词性

词的分类

  • 实词:名词、动词、形容词、状态词、区别词、数词、量词、代词
  • 虚词:副词、介词、连词、助词、拟声词、叹词。

ICTPOS3.0词性标记集

n 名词

nr 人名