Skip to content

Instantly share code, notes, and snippets.

View juliengdt's full-sized avatar
🎯
Focusing

juliengdt juliengdt

🎯
Focusing
View GitHub Profile
@juliengdt
juliengdt / ErrorEnum.h
Created May 26, 2016 07:45
HTTP Error code enumerations - Objective-C
typedef NS_ENUM(NSInteger, HTTPCodeInformation) {
Continue100 = 100,
SwitchingProtocols101 = 101,
Processing102 = 102
};
typedef NS_ENUM(NSInteger, HTTPCodeSuccess) {
Success200 = 200,
Created201 = 201,
require 'formula'
class Oclint < Formula
homepage 'http://oclint.org'
url 'https://github.com/oclint/oclint/releases/download/v0.10.2/oclint-0.10.2-x86_64-darwin-15.2.0.tar.gz'
version '0.10.2'
sha1 '4b61f83ccd55eeaa968ca5ee159e2528b4fbfeb5'
devel do
url 'https://github.com/oclint/oclint/releases/download/v0.10.2/oclint-0.10.2-x86_64-darwin-15.2.0.tar.gz'
@juliengdt
juliengdt / pipinstall.py
Created June 16, 2016 08:55
PIP Installation
This file has been truncated, but you can view the full file.
#!/usr/bin/env python
#
# Hi There!
# You may be wondering what this giant blob of binary data here is, you might
# even be worried that we're up to something nefarious (good for you for being
# paranoid!). This is a base85 encoding of a zip file, this zip file contains
# an entire copy of pip.
#
# Pip is a thing that installs packages, pip itself is a package that someone
# might want to install, especially if they're looking to run this get-pip.py
@juliengdt
juliengdt / uncrustify.cfg
Last active July 5, 2016 13:12
Uncrustify Configuration file, sticked to Raw Wenderlich Objective-C style guide. This document is to copy on YOUR root folder (near Documents/)
#
# Uncrustify Configuration File
# File Created With UncrustifyX 0.4.3 (252)
#
# Alignment
# ---------
## Alignment
@juliengdt
juliengdt / UIImageView+DottableExtension.m
Created July 5, 2016 09:03
Extension for UIImage to set a dotted pattern as image source
@interface UIImageView (DottableImage)
- (void) dottedPatternFrom:(CGPoint)fromPoint to:(CGPoint)toPoint forWidth:(CGFloat)width;
@end
@implementation UIImageView (DottableImage)
float const DefaultDottedImageWidth = 5.0f;
@juliengdt
juliengdt / UILabel+Formattable.m
Created July 12, 2016 12:23
Bold UILabel text by loading it to attributedText, quitted by "*--*"
- (void)boldSubText
{
NSString *textToAttribute = @"abcdefg*-hijklm-*nopqrst*-uvwxyz-*";
NSDictionary *boldAttributeDict = @{NSFontAttributeName:
[UIFont robotoBoldFontOfSize:MODAL_INFORMATION_FONT_SIZE_DESCRIPTION]};
NSArray<NSString *> *splittedSubText = [textToAttribute componentsSeparatedByString:@"*"];
NSMutableArray<NSAttributedString*> *splittedAttributedStringArray = [[NSMutableArray alloc] initWithCapacity:splittedSubText.count];
[splittedSubText enumerateObjectsUsingBlock:^(NSString *_Nonnull splittedString, NSUInteger idx, BOOL *_Nonnull stop) {
@juliengdt
juliengdt / HCElasticFlowLayout.m
Created July 18, 2016 13:17
HCElasticFlowLayout - Elastic Flow layout for UICollectionView
#import <UIKit/UIKit.h>
#ifndef __IPHONE_7_0
#error Because of Dynamic Kit, this custom flowLayout requires APIs only available in iOS SDK 7.0 and later
#endif
/**
* A UICollectionViewFlowLayout subclass that, when implemented,
* creates a dynamic / elastic scroll effect for UICollectionViews
*/
@juliengdt
juliengdt / AlamofirePrintable.swift
Created September 1, 2016 09:24
Pretty print extension for Alamofire Request
extension Alamofire.Request {
func responseDebugPrint() -> Self {
return responseJSON() {
response in
if let JSON: AnyObject = response.result.value,
JSONData = try? NSJSONSerialization.dataWithJSONObject(JSON, options: .PrettyPrinted),
prettyString = NSString(data: JSONData, encoding: NSUTF8StringEncoding) {
print(prettyString)
} else if let error = response.result.error {
print("Error Debug Print: \(error.localizedDescription)")
@juliengdt
juliengdt / DynamicTypeMadeItEasy.swift
Created September 26, 2016 16:04
Dynamic Type handling in Swift 3, just by using Dynamic Type as Font everywhere in the app, no more manual refresh on notification needed
//
// FontConfiguration.swift
// juliengdt
//
// Created by Julien Goudet on 26/09/2016.
// Based on: https://www.iphonelife.com/blog/31369/swift-programming-101-mastering-dynamic-type-ios
//
import Foundation
extension UICollectionView {
public var rx_reachedBottom: Observable<Void> {
return self.rx.contentOffset
.map { contentOffset in
var responder: UIResponder = self
var viewController: UIViewController? = nil
while let next = responder.next {
viewController = next as? UIViewController
if viewController != nil {