Skip to content

Instantly share code, notes, and snippets.

View jamesrochabrun's full-sized avatar
🇵🇪

James Rochabrun jamesrochabrun

🇵🇪
View GitHub Profile
@jamesrochabrun
jamesrochabrun / meta-tags.md
Created February 12, 2016 21:08 — forked from kevinSuttle/meta-tags.md
List of Usable HTML Meta and Link Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
@jamesrochabrun
jamesrochabrun / KeyboardNotification.m
Created April 9, 2016 00:56 — forked from braking/KeyboardNotification.m
Adjust content insets of a tableview when keyboard opens.
- (void)viewDidLoad
{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
@jamesrochabrun
jamesrochabrun / gist:61e43857e0d8c80bbc04a90f75a371d3
Created July 15, 2016 06:04 — forked from iwasrobbed/gist:5528897
UICollectionView w/ NSFetchedResultsController & NSBlockOperation. Idea originated from Blake Watters (https://github.com/AshFurrow/UICollectionView-NSFetchedResultsController/issues/13)
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller
{
self.shouldReloadCollectionView = NO;
self.blockOperation = [[NSBlockOperation alloc] init];
}
- (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id<NSFetchedResultsSectionInfo>)sectionInfo
atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type
{
__weak UICollectionView *collectionView = self.collectionView;
//: Playground - noun: a place where people can play
enum Direction {
case up
case down
case left
case right
}
//step 1 conform te protocols
//: Playground - noun: a place where people can play
import UIKit
//Diffeerence between structs and classes
struct User {
var name: String
var email: String
//: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
//Arrays
var teams: Array = ["barce", "rm", "atle"]
var champ: Array = ["champ", "liga", "eiro"]
var position: Array = [1,2,3,4]
//: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
var animals: Array = ["duck", "dog", "rabbit"]
for animal in animals {
print(animal)
//: Playground - noun: a place where people can play
//force unwrapping, bad code!
struct Person {
let firstName : String
let middleName: String?
let lastName: String
//: Playground - noun: a place where people can play
//STRUCTS
struct Point {
//stored properties
let x: Int
let y: Int
//: Playground - noun: a place where people can play
import Foundation
//basic syntax
func sayHello () {
print("hello")
}
sayHello()