Skip to content

Instantly share code, notes, and snippets.

View pietrorea's full-sized avatar
✌️

Pietro Rea pietrorea

✌️
View GitHub Profile
@sspencer
sspencer / AFNetworkingRequest.m
Created November 18, 2011 23:58
AFNetworking Request
// using ARC, so no release / autorelease
AFHTTPClient *client = [AFHTTPClient clientWithBaseURL:[NSURL URLWithString:@"http://localhost"]];
[client setAuthorizationHeaderWithUsername:@"steve" password:@"mypass"];
NSURLRequest *request = [client requestWithMethod:@"GET" path:@"/auth.php" parameters:nil];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[operation
setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"success: %@", operation.responseString);
@tarnfeld
tarnfeld / MMPageViewController.h
Created February 25, 2012 12:56
View controller rotation for page view controller child view controllers
#import <UIKit/UIKit.h>
@interface MMPageViewController : UIPageViewController
@end
@revolunet
revolunet / landing-pages.md
Last active February 28, 2018 05:01
Beautiful SAAS landing pages
@kennydee
kennydee / Fastfile
Last active September 23, 2018 18:49
Fastfile for staging environment with Appetize.io on React Native (iOs & Android), with statuses update on Github Enterprise
require 'httparty'
fastlane_version "1.95.0"
default_platform :ios
before_all do
# put here your token and iOs scheme app
ENV["GITHUB_TOKEN"] = "---"
ENV["APPETIZE_TOKEN"] = "---"
ENV["APP_IOS_SCHEME"] = "---"
@quellish
quellish / xcci.md
Created October 28, 2014 03:03
Xcode CI script variables

Variable

Type

@timsutton
timsutton / set_default_color_profile.py
Last active April 29, 2021 14:28
Very basic example to set a display device's default colorsync profile.
#!/usr/bin/python
import objc
import Foundation
import Quartz
# replace with url-encoded path to an icc profile
URL_ENCODED_ICC_PATH = 'file:///Library/Application%20Support/Adobe/Color/Profiles/SMPTE-C.icc'
# stripped bridge metadata of all we need for this sample:
@patricklynch
patricklynch / gist:689525d466c4ada42b8e
Last active October 30, 2021 05:23
The 6 ways to unwrap optionals in Swift 2.0
// The 6 ways to uwnrap optionals in Swift 2.0
//
// Created by Patrick Lynch on 6/28/15.
// Copyright © 2015 Patrick Lynch. All rights reserved.
import Foundation
// 1. Force Unwrapping
// 2. Optional Binding
// 3. Optional Chaining
@gcatlin
gcatlin / gist:1847248
Created February 16, 2012 19:43
Install specific version of Homebrew formula
brew update
brew versions FORMULA
cd `brew --prefix`
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions"
brew install FORMULA
brew switch FORMULA VERSION
git checkout -- Library/Formula/FORMULA.rb # reset formula
## Example: Using Subversion 1.6.17
#
@evadne
evadne / gist:4544569
Last active August 14, 2023 05:04
Todd Laney’s enhancements to Sticky Headers + UICollectionViewFlowLayout
//
// StickyHeaderLayout.h
// Wombat
//
// Created by Todd Laney on 1/9/13.
// Copyright (c) 2013 ToddLa. All rights reserved.
//
// Modified from http://blog.radi.ws/post/32905838158/sticky-headers-for-uicollectionview-using THANKS!
//
@Mins
Mins / mysql_secure.sh
Last active February 16, 2024 00:03
Automating mysql_secure_installation
#!/bin/bash
aptitude -y install expect
// Not required in actual script
MYSQL_ROOT_PASSWORD=abcd1234
SECURE_MYSQL=$(expect -c "
set timeout 10