Skip to content

Instantly share code, notes, and snippets.

View nedimf's full-sized avatar
🔥
building blazing.report - reimagine mobile analytics

Nedim nedimf

🔥
building blazing.report - reimagine mobile analytics
View GitHub Profile
Martin is creating a iOS app that will check if a user exists and an API to fetch the data associated with respective phone number. Allows you to upload thumbnails. (see below for agenda)
--------------------------
Programming Language: Swift
--------------------------
Are you using SwiftUI?
UIKit
--------------------------
What's On The Agenda (Detailed) ?
LOGIN
@RNHTTR
RNHTTR / didSelectRowAtIndexPath.swift
Created September 23, 2017 20:01
An example of how to use tableView(_:didSelectRowAt:) to manage what happens when users select a UITableViewCell
// Use tableView(_:didSelectRowAt:) to manage what happens when a user selects a UITableViewCell.
// This example exhibits how this app makes use of this method.
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
// Determine what to do when a cell in a particular section is selected.
switch indexPath.section {
case 0:
// If the cell in the first section is selected, this will trigger the segue with the "toHeightForRowAt" identifier
self.performSegue(withIdentifier: "toHeightForRowAt", sender: nil)
@Kilo-Loco
Kilo-Loco / record-simulator.sh
Created August 4, 2020 20:11
Bash script for recording Xcode Simulator
#!/bin/bash
echo "🤔 Enter a video name:"
read name
name="${name}.mp4"
echo
echo "📹 Recording $name"
echo
@lvterry
lvterry / getAssetThumbnail.swift
Created March 28, 2016 14:57
Convert PHAsset to UIImage with Swift
// it returns a square thumbnail.
func getAssetThumbnail(asset: PHAsset, size: CGFloat) -> UIImage {
let retinaScale = UIScreen.mainScreen().scale
let retinaSquare = CGSizeMake(size * retinaScale, size * retinaScale)
let cropSizeLength = min(asset.pixelWidth, asset.pixelHeight)
let square = CGRectMake(0, 0, CGFloat(cropSizeLength), CGFloat(cropSizeLength))
let cropRect = CGRectApplyAffineTransform(square, CGAffineTransformMakeScale(1.0/CGFloat(asset.pixelWidth), 1.0/CGFloat(asset.pixelHeight)))
let manager = PHImageManager.defaultManager()
@guinso
guinso / main.go
Created October 9, 2017 02:07
Sample SMTP with attachment
package main
import (
"crypto/tls"
"encoding/base64"
"fmt"
"io/ioutil"
"log"
"net/smtp"
"strings"
@powhu
powhu / GIF2MP4.swift
Last active December 28, 2023 22:41
Swift 5.0 GIF to MP4
//
// GIF2MP4.swift
//
// Created by PowHu Yang on 2020/4/24.
// Copyright © 2020 PowHu Yang. All rights reserved.
//
/* How to use
let data = try! Data(contentsOf: Bundle.main.url(forResource: "gif", withExtension: "gif")!)
let tempUrl = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("temp.mp4")
@sindresorhus
sindresorhus / PHImageManager-requestImage-async.swift
Created November 3, 2021 05:46
How to use `PHImageManager#requestImage` with async/await in Swift.
import Photos
struct UnexpectedNilError: Error {}
extension PHImageManager {
func requestImage(
for asset: PHAsset,
targetSize: CGSize,
contentMode: PHImageContentMode,
options: PHImageRequestOptions?
@tomasbasham
tomasbasham / UIImage+Scale.m
Last active February 1, 2024 19:04
Scale a UIImage to any given rect keeping the aspect ratio
@implementation UIImage (scale)
/**
* Scales an image to fit within a bounds with a size governed by
* the passed size. Also keeps the aspect ratio.
*
* Switch MIN to MAX for aspect fill instead of fit.
*
* @param newSize the size of the bounds the image must fit within.
* @return a new scaled image.
@konnnn
konnnn / UILabel+Padding.swift
Last active February 22, 2024 13:24
Swift 4: Adding space/padding to a UILabel Programmatically and Storyboard
/*
If you use Storyboard, don't forget to set UIlabel to PaddingLabel
*/
import UIKit
class PaddingLabel: UILabel {
var topInset: CGFloat
var bottomInset: CGFloat
@gabrielemariotti
gabrielemariotti / Readme.md
Last active March 2, 2024 23:10
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example: