Skip to content

Instantly share code, notes, and snippets.

Valerio Mazzeo valeriomazzeo

  • London
Block or report user

Report or block valeriomazzeo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View HTTPMethod+RawRepresentable.swift
import Foundation
import HTTP
extension HTTPMethod: RawRepresentable {
// swiftlint:disable:next cyclomatic_complexity function_body_length
public init?(rawValue: String) {
switch rawValue.uppercased() {
case "GET":
self = .GET
valeriomazzeo / dockerhub_versions
Created Apr 11, 2018
List docker container tags from docker hub
View dockerhub_versions
# get token from Docker Hub
DOCKER_HUB_TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${DOCKER_HUB_USERNAME}'", "password": "'${DOCKER_HUB_PASSWORD}'"}' | jq -r .token)
# get tags for repo
IMAGE_TAGS=$(curl -s -H "Authorization: JWT ${DOCKER_HUB_TOKEN}"${REPO_NAME}/tags/?page_size=10000 | jq -r '.results|.[]|.name')
# generate a file containing each version on a new line excluding latest
printf '%s\n' ${IMAGE_TAGS#latest} > versions
valeriomazzeo / github_release.rb
Created Jul 5, 2017
Creates or update a GitHub release for the given tag name
View github_release.rb
#!/usr/bin/env ruby
require 'optparse'
require 'octokit'
options = {} do |opt|
opt.on('-s', '--secret SECRET', 'GitHub access token') { |o| options[:secret] = o }
opt.on('-r', '--repo-slug REPO_SLUG', 'Repo slug. i.e.: apple/swift') { |o| options[:repo_slug] = o }
opt.on('-c', '--changelog-file CHANGELOG_FILE', 'Changelog path') { |o| options[:changelog_file] = o }
View PageViewController.swift
public final class PageViewController: UIViewController {
// MARK: Initialization
public required init(viewControllers: [UIViewController]) {
self.viewControllers = viewControllers
super.init(nibName: nil, bundle: nil)
public required init?(coder aDecoder: NSCoder) {
View PercentDrivenInteractiveTransition.swift
import UIKit
open class PercentDrivenInteractiveTransition: NSObject {
// MARK: Initialization
public required init(animator: UIViewControllerAnimatedTransitioning) {
self.animator = animator
valeriomazzeo / ViewAdapter.swift
Last active Aug 10, 2016
Easy way to populate UIView properties with data.
View ViewAdapter.swift
// ViewAdapter.swift
// Created by Valerio Mazzeo on 10/08/2016.
// Copyright © 2016 Valerio Mazzeo. All rights reserved.
import UIKit
valeriomazzeo / UIScrollView+Parallax.swift
Last active Jul 2, 2018
Add parallax effect to any scrollview subview
View UIScrollView+Parallax.swift
// UIScrollView+Parallax.swift
// Parallax
// Created by Valerio Mazzeo on 20/05/2016.
// Copyright © 2016 Valerio Mazzeo. All rights reserved.
import UIKit
valeriomazzeo / tview.m
Created Feb 26, 2016
Updating Height of Self-Sizing Table View Cell With Text View
View tview.m
@interface TView : UITextView
@property (nonatomic) CGFloat preferredMaxLayoutWidth;
@implementation TView
- (instancetype)initWithFrame:(CGRect)frame
valeriomazzeo / gist:6feeb07969edabba2326
Last active Feb 25, 2016
Dynamic TableHeaderView Height
View gist:6feeb07969edabba2326
- (void)viewDidLoad
[super viewDidLoad];
self.label = [[UILabel alloc] initWithFrame:CGRectZero];
self.label.translatesAutoresizingMaskIntoConstraints = NO;
self.label.backgroundColor = [UIColor redColor];
self.label.textAlignment = NSTextAlignmentCenter;
self.label.numberOfLines = 0;
self.label.text = @"Valerio adjkashdjk asdjk asd adj aklsdjasl dkjasdkl askldj aklsdj aklsddj aklsdj aklsdjaklsdj aklsdj aklsd Tiziano.";
valeriomazzeo / RKObjectManager.m
Created May 11, 2015
RKObjectManager Extension
View RKObjectManager.m
#pragma mark - Standard Methods Extensions
- (NSMutableURLRequest *)multipartFormRequestAtPathForRelationship:(NSString *)relationshipName
path:(NSString *)path
parameters:(NSDictionary *)parameters
constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block
RKRoute *route = [self.router.routeSet routeForRelationship:relationshipName ofClass:[object class] method:method];
You can’t perform that action at this time.