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
@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")
@tadija
tadija / FontNames-iOS-17.4.swift
Last active April 30, 2024 00:30
iOS - All Font Names
/*
*** Academy Engraved LET ***
AcademyEngravedLetPlain
---------------------
*** Al Nile ***
AlNile
AlNile-Bold
---------------------
*** American Typewriter ***
AmericanTypewriter
@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()
@tkersey
tkersey / links.md
Last active May 4, 2024 18:55
For future reference but maybe not.
@alok87
alok87 / sendmail.go
Created October 21, 2015 10:10
Sendmail Using Golang without SMTP- Example
package main
import (
"io/ioutil"
"os/exec"
"fmt"
)
// EXAMPLE: echo "Subject: TestnHello" | sendmail -f you@domain.com you@domain.com
// Useful Links: https://gobyexample.com/spawning-processes
@jtbonhomme
jtbonhomme / nc.md
Last active April 2, 2024 10:57
Using Netcat for File Transfers

Netcat is like a swiss army knife for geeks. It can be used for just about anything involving TCP or UDP. One of its most practical uses is to transfer files. Non *nix people usually don't have SSH setup, and it is much faster to transfer stuff with netcat then setup SSH. netcat is just a single executable, and works across all platforms (Windows,Mac OS X, Linux).

Destination

On the receiving (destination) terminal, run:

nc -l -p 1234 > out.file 
@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:

@soheilhy
soheilhy / nginxproxy.md
Last active March 22, 2024 08:54
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@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.