Skip to content

Instantly share code, notes, and snippets.

View WahdanZ's full-sized avatar
🐧
Bazinga!!

Ahmed Wahdan WahdanZ

🐧
Bazinga!!
View GitHub Profile
@WahdanZ
WahdanZ / Fastfile_ios.rb
Created August 6, 2021 21:55 — forked from bbedward/Fastfile_ios.rb
CI/CD In Flutter using GitLab and Fastlane Tutorial
# Automatically update fastlane
update_fastlane
default_platform(:ios)
# Default temporary keychain password and name, if not included from environment
TEMP_KEYCHAIN_NAME_DEFAULT = "fastlane_flutter"
TEMP_KEYCHAN_PASSWORD_DEFAULT = "temppassword"
# Remove the temporary keychain, if it exists
@WahdanZ
WahdanZ / Api.java
Created February 17, 2018 16:02 — forked from imminent/Api.java
Call retrying with Retrofit 2.0
package com.example.api;
import java.util.Map;
import retrofit.Call;
import retrofit.http.Body;
import retrofit.http.GET;
import retrofit.http.POST;
public interface Api {
@WahdanZ
WahdanZ / timeago.swift
Created December 2, 2017 17:39 — forked from minorbug/timeago.swift
"Time ago" function for Swift (based on MatthewYork's DateTools for Objective-C)
func timeAgoSinceDate(date:NSDate, numericDates:Bool) -> String {
let calendar = NSCalendar.currentCalendar()
let unitFlags = NSCalendarUnit.CalendarUnitMinute | NSCalendarUnit.CalendarUnitHour | NSCalendarUnit.CalendarUnitDay | NSCalendarUnit.CalendarUnitWeekOfYear | NSCalendarUnit.CalendarUnitMonth | NSCalendarUnit.CalendarUnitYear | NSCalendarUnit.CalendarUnitSecond
let now = NSDate()
let earliest = now.earlierDate(date)
let latest = (earliest == now) ? date : now
let components:NSDateComponents = calendar.components(unitFlags, fromDate: earliest, toDate: latest, options: nil)
if (components.year >= 2) {
return "\(components.year) years ago"