Skip to content

Instantly share code, notes, and snippets.

View ntnmrndn's full-sized avatar

Marandon Antoine ntnmrndn

View GitHub Profile
# coding: utf-8
require 'active_support/core_ext/array'
require 'active_support/core_ext/string/inflections'
module Pod
# Validates a Specification.
#
# Extends the Linter from the Core to add additional which require the
# LocalPod and the Installer.
#
// MARK: - Caches
public protocol DirectoryCachable {
var directoryName: String { get }
}
extension Caches {
// MARK: - DataCacheStack
/// A synchronous, thread safe, directory cache.
class CamembertProgressView: UIView {
private let camembertFillingLayer = CAShapeLayer()
private let lineWidth: CGFloat = 5
private let color = UIColor.white.cgColor
var progress: CGFloat = 0 {
didSet {
camembertFillingLayer.strokeEnd = progress
}
}
override init(frame: CGRect) {
@ntnmrndn
ntnmrndn / UIImage+convertToGreyScale.swift
Created January 20, 2015 06:33
A swift UIImage category to convert an image to black and white (truly, in shades of gray); preserving alpha as alpha.
//
// UIImage+convertToGreyScale.swift
// itooch
//
// Created by Antoine Marandon on 15/01/2015.
// Copyright (c) 2015 eduPad. All rights reserved.
//
import Foundation
private var metaPool = [String:[Any]]()
protocol Poolable: Any {
init()
}
class Pool<T: Poolable> {
private static var typeKey: String {
return "\(T.self)"
}
@ntnmrndn
ntnmrndn / LIFOOperationQueue.swift
Last active July 30, 2018 06:43
Swift LIFO Queue
//
// LIFOOperationQueue.swift
//
//
// Created by Antoine Marandon on 27/07/2018.
//
import Foundation
/// Last in First Out Operation queue.
/// Last in First Out Operation queue.
class LIFOOperationQueue {
enum Priority {
case high
case low
}
private let queue: DispatchQueue
private var highPriorityOperations = [Operation]()
private var lowPriorityOperations = [Operation]()
@ntnmrndn
ntnmrndn / Paris.md
Last active July 24, 2018 09:08
A Readme for my friends visiting Paris.

Un petit guide Parisien

Generic tips

Paris is small. Most point of interest are within walking/biking distance of each other. Don't hesitate to rent a bike in one of the numerous spots all around the city. Here how it works:

  • Pay for one day or more
  • Take a bike anywhere, put it back anywhere. First 30min of each ride is free, but you can always put it back and take it again :p
//
// NSString+Levenshtein.h
// PyHelp
//
// Modified by Michael Bianco on 12/2/11.
// <http://mabblog.com>
//
// Created by Rick Bourner on Sat Aug 09 2003.
// rick@bourner.com
@ntnmrndn
ntnmrndn / gist:6234677
Last active December 21, 2015 02:19
Riddle
#include <stdio.h>
int main () {
char str[-~5];
int i=42^42;
str[sizeof(str)+--i]=i+++i;
*(int*)str=015734060512,++i;
i<<=!i<=i;
str[i*i] = *(str+i*i-1)^!!i;
printf("%s!\n", str);
}