Skip to content

Instantly share code, notes, and snippets.

View ahbou's full-sized avatar
shipping

Ahmed Bouchfaa ahbou

shipping
View GitHub Profile
@ahbou
ahbou / PHImageManager_iCloud_Remote.m
Last active October 8, 2019 13:32
Retreive an image from iCoud using PHImageManager
PHImageRequestOptions *options = [[PHImageRequestOptions alloc] init];
options.deliveryMode = PHImageRequestOptionsDeliveryModeHighQualityFormat;
options.synchronous = NO;
options.networkAccessAllowed = YES;
options.progressHandler = ^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {
NSLog(@"%f", progress); //follow progress
};
//This will work
[[PHImageManager defaultManager] requestImageForAsset:myPhAsset targetSize:self.view.frame.size contentMode:PHImageContentModeAspectFill options:options resultHandler:
@ahbou
ahbou / ComposeView.swift
Last active July 12, 2019 03:30
iPhone X InputAccessoryView Fix
//
// ComposeView.swift
import UIKit
class ComposeView: UIView {
// ........
// Other layout code and methods
// ........
@ahbou
ahbou / UIWindow+Extension.swift
Created June 1, 2018 11:00
Animate UIWindow rootViewController switch
extension UIWindow {
func setRootViewController(_ rootViewController: UIViewController?, animated: Bool) {
guard let viewContoller = rootViewController else {
self.rootViewController = rootViewController
return
}
var snapShotView: UIView?
@ahbou
ahbou / ReCodeSign
Created February 2, 2017 23:46 — forked from 0xc010d/ReCodeSign
Codesign an iOS app, with a different distribution certificate and mobileprovisioning file.
- Copy the delivered ipa into a directory to work in.
- export PlistBuddy="/usr/libexec/PlistBuddy" to get the PlistBuddy tool to your shell. If it is not added, all references to PlistBuddy
will need to be written as the full path.
- Take the delivered App.ipa and unzip it using the unzip command. This should produce a Payload directory containing the app and its
resources.
- Enter the command "codesign -d --entitlements :enterprise.plist Payload/PathToApp.app/" This pulls the entitlements out of the app, and
prints them to a plist, without a leading "blob" of data. Pay particular attention to the colon before the enterprise.plist file name.
{
af: { code: 'af', name: 'Afghanistan' },
ax: { code: 'ax', name: 'Åland Islands' },
al: { code: 'al', name: 'Albania' },
dz: { code: 'dz', name: 'Algeria' },
as: { code: 'as', name: 'American Samoa' },
ad: { code: 'ad', name: 'AndorrA' },
ao: { code: 'ao', name: 'Angola' },
ai: { code: 'ai', name: 'Anguilla' },
aq: { code: 'aq', name: 'Antarctica' },
@ahbou
ahbou / fresh-mac-setup.md
Created January 9, 2017 15:20 — forked from bernsno/cmal-fresh-mac-setup.md
Fresh Mac Setup

New Computer Setup

Last tested using Mac OS X 10.8 Mountain Lion

Before Wiping Original Install

  • Backup .ssh folder to avoid having to regenerate codes for services such as Heroku and Github.
@ahbou
ahbou / rails_setup.sh
Last active December 15, 2016 11:04
Managing multiple Rails version with Bundler and rbenv
# make sure homebrew is up to date
brew update
# update ruby version
brew upgrade ruby-build
# install latest stable version
rbenv install 2.3.3
#set version as global
rbenv global 2.3.3
#install bundler for that ruby version
gem install bundler
<?
/*
This is part of the Reprise framework, not yet released publicly.
Copyright 2013 Marco Arment. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
@ahbou
ahbou / DumpiOSFonts.m
Last active June 21, 2016 15:45 — forked from shannoga/gist:1008678
Get fonts family and font names list on iOS
// List all fonts on iPhone
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSArray *fontNames;
NSInteger indFamily, indFont;
for (indFamily=0; indFamily < familyNames.count; ++indFamily)
{
NSLog(@"Family name: %@", familyNames[indFamily]);
fontNames = [[NSArray alloc] initWithArray:
[UIFont fontNamesForFamilyName:familyNames[indFamily]]];

Keybase proof

I hereby claim:

  • I am ahbou on github.
  • I am ahbou (https://keybase.io/ahbou) on keybase.
  • I have a public key whose fingerprint is C4FB 1E06 E840 050B 7969 713E 132A E782 14BC 87D7

To claim this, I am signing this object: