• Use self
only when needed. Avoid if possible.
• Prefer let
over var
• Use guard
as often as possible, instead of nesting if
s.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define a function to run ffmpeg with arguments | |
function RunFfmpeg($arguments) | |
{ | |
Write-Host "Running FFmpeg with arguments: $arguments" | |
$processStartInfo = New-Object System.Diagnostics.ProcessStartInfo | |
$processStartInfo.FileName = "ffmpeg" | |
$processStartInfo.Arguments = $arguments | |
$processStartInfo.UseShellExecute = $false | |
$processStartInfo.RedirectStandardOutput = $true | |
$process = New-Object System.Diagnostics.Process |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import Swifter | |
enum HTTPMethod { | |
case POST | |
case GET | |
} | |
class HTTPDynamicStubs { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Retain cycles are very easy to make when you have complex closures | |
//For example here `childRouter` is being captured as a strong in the closure | |
//Causing a leak for ALL routers in my app | |
//The funny thing was that I was looking at this piece of code for 15 minutes and couldn't find anything wrong | |
func addChildRouter(childRouter : Router) { | |
childRouters.append(childRouter) | |
if let removeObservable = childRouter.removeFromParentRouter { | |
removeObservable.subscribeNext({ [weak self] in |