Skip to content

Instantly share code, notes, and snippets.

View ldenoue's full-sized avatar
🏔️

Laurent Denoue ldenoue

🏔️
View GitHub Profile
{
"hello": "Salut",
"common.copy_url": "Copier l'URL de la salle de chat",
"common.copy_succ_hint": "Copié dans le presse-papiers",
"com.room_card.join_btn": "Joindre",
"index": {
"faq_title": "FAQ",
@ldenoue
ldenoue / showSpinner.m
Last active December 17, 2019 14:27
show and hide a fullscreen overlay UIView with a spinner; works even in Action/Share extensions that don't have [UIApplication sharedApplication]
#define OVERLAY_VIEW_TAG 298739
-(void)showSpinner
{
UIView *back = [[UIView alloc]initWithFrame:CGRectMake(0, 0, UIScreen.mainScreen.bounds.size.width, UIScreen.mainScreen.bounds.size.height)];
back.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.6];
back.tag = OVERLAY_VIEW_TAG;
[self.view addSubview:back];
UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
spinner.center = back.center;
@ldenoue
ldenoue / sharewkwebview.m
Created November 8, 2019 13:11
Capture and share the full content of a WKWebView as a UIImage
-(void)shareHighlightsAsImage:(NSDictionary *)note
{
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"quotes" ofType:@"html"];
NSString *fileContents = [NSString stringWithContentsOfFile: filePath encoding:NSUTF8StringEncoding error:nil];
fileContents = [fileContents stringByReplacingOccurrencesOfString:@"{{url}}" withString:note[@"url"]];
fileContents = [fileContents stringByReplacingOccurrencesOfString:@"{{title}}" withString:note[@"title"]];
fileContents = [fileContents stringByReplacingOccurrencesOfString:@"{{datetime}}" withString:note[@"datetime"]];
fileContents = [fileContents stringByReplacingOccurrencesOfString:@"{{highlights}}" withString:note[@"highlights"]];
WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
@ldenoue
ldenoue / make-app-icon-ffmpeg.sh
Last active June 25, 2019 09:00
make app icon for iOS using ffmpeg
if [ "$#" -eq 2 ]
then
mkdir $2
ffmpeg -y -i $1 -vf scale=20x20 $2/[email protected]
ffmpeg -y -i $1 -vf scale=40x40 $2/[email protected]
ffmpeg -y -i $1 -vf scale=60x60 $2/[email protected]
ffmpeg -y -i $1 -vf scale=29x29 $2/[email protected]
ffmpeg -y -i $1 -vf scale=58x58 $2/[email protected]
@ldenoue
ldenoue / gist:15310d7838733b7f26a746c560275d8c
Last active November 26, 2021 20:41
Screenshots and app previews for iOS apps on the App Store
/*
App Screenshots:
3 sizes are required for universal apps (iPhone and iPad)
- 5.5in screens: run simulator with "iPhone 6s+" and take screenshots (1242x2208) video=1080x1920
- 6.5in screens: run simulator with "iPhone XR" and take screenshots (1242x2688) video=886x1920
- 12.9in screens: run simulator with "iPad (2nd or 3d generation" and take screenshots (2048×2732) video=1200x1600
App Preview videos:
1 - Record simulator video: xcrun simctl io booted recordVideo in.mp4
@ldenoue
ldenoue / openURL
Created May 9, 2016 13:30
openURL from Action Extension in iOS without using [UIApplication sharedApplication]
UIResponder *responder = self;
while(responder){
if ([responder respondsToSelector: @selector(OpenURL:)]){
[responder performSelector: @selector(OpenURL:) withObject: [NSURL URLWithString:url]];
}
responder = [responder nextResponder];
}
@ldenoue
ldenoue / gist:1fd2fca6c01c298bbef767d7f1811ec9
Created May 2, 2016 19:16
make opaque status bar even with self.navigationController.hidesBarsOnSwipe = YES
- (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView {
self.navigationController.navigationBarHidden = NO;
}
-(void)opaqueStatusBar:(UIScrollView *)scrollView
{
scrollView.delegate = self;
UIView *statusBarBg = [self.navigationController.view viewWithTag:3000];
if (statusBarBg == nil)
{