Skip to content

Instantly share code, notes, and snippets.

View juliengdt's full-sized avatar
🎯
Focusing

juliengdt juliengdt

🎯
Focusing
View GitHub Profile
@juliengdt
juliengdt / CollectionTypeSkipper.swift
Created March 30, 2016 14:15
CollectionType Skipper
// MARK: - CollectionType Addition
extension CollectionType {
/**
Create and return a new CollectionType made with only skipped items, which index is not a divider of "skip"
- parameter skip: the divider index
- returns: the new collectionType
*/
func skip(skip: Int) -> [Generator.Element] {
@juliengdt
juliengdt / HCLog_Playground_V2.swift
Last active May 19, 2016 09:28
Swift Protocol Logger with level condition, Swift 2.X and Swift 3.X version
//: Playground - noun: a place where people can play
// Usage for Swift 2.X using the deadly old Swift Debugger Identifiers, ie: __FILE__
// @see: https://github.com/apple/swift-evolution/blob/master/proposals/0028-modernizing-debug-identifiers.md
enum LogLevel: Int {
case verbose = 1
case debug = 2
case info = 3
case warning = 4
@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 / 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 / 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 / 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 / .gitignore
Last active July 27, 2016 21:04
XCode Gitignore
# Created by https://www.gitignore.io/api/carthage,objective-c,swift,xcode,osx
### Carthage ###
# Carthage - A simple, decentralized dependency manager for Cocoa
Carthage.checkout
Carthage.build
### Objective-C ###
# Xcode