Skip to content

Instantly share code, notes, and snippets.

View ashikahmad's full-sized avatar

Ashik Uddin Ahmad ashikahmad

View GitHub Profile
@ashikahmad
ashikahmad / 1-ObsidianPreviousNextDay.md
Last active August 1, 2023 00:29
Obsidian Script to Show Previous/Next Day Link

Obsidian Script to Show Previous/Next Day Link

Caution!
It is always a good practice to check the code-snippet and see what you're running. Although I personally use this, if you use it, use at your own risk.

Requirements

You need to have Dataview plugin installed and also "Enable JavaScript Queries" enabled.

Setup

func with<T: AnyObject>(_ obj: T, task: (T)->Void) -> T {
task(obj)
return obj
}
import UIKit
import PlaygroundSupport
extension String: Error {}
func getEvenNumber() -> Future<Int> {
return Future<Int>.create { p in
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
let num = Int.random(in: 0...20)
if num % 2 == 0 {
@ashikahmad
ashikahmad / .phoenix.js
Last active May 24, 2018 03:20
My Phoenix dot file (configuration)
/*
Created by Ashik uddin Ahmad
Copyright © 2017 Ashik uddin Ahmad. All rights reserved.
*/
//------------------------------------------------------
// Overview
//------------------------------------------------------
/*
@ashikahmad
ashikahmad / Reusable.swift
Created July 31, 2017 09:24
Makes life a little easier with UITableView or UICollectionView cells and some more :)
//
// Reusable.swift
// TodoMVVM
//
// Created by Ashik uddin Ahmad on 7/20/17.
// Copyright © 2017 Ashik uddin Ahmad. All rights reserved.
//
import UIKit
@ashikahmad
ashikahmad / SafeOptional.swift
Created July 31, 2017 09:22
Using optionals easily: save you from frequent coelsing
//
// SafeOptional.swift
// TodoMVVM
//
// Created by Ashik uddin Ahmad on 7/20/17.
// Copyright © 2017 Ashik uddin Ahmad. All rights reserved.
//
import Foundation
@ashikahmad
ashikahmad / FontList.swift
Last active July 27, 2017 20:28
Prints all available fonts in console. Try pasting this code in Xcode Playground.
import UIKit
/*
Prints all available fonts in console. Try pasting this code in Xcode Playground
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
┌───────────┐
│ All Fonts │
└┬──────────┘
├─┬─⦿ Family with fonts
@ashikahmad
ashikahmad / DayOrdinal.swift
Last active February 4, 2019 16:29
A Playground (swift code) to show a workaround of day ordinal (Ex: `1st` February) with DateFormatter
//----------------------------------------------------------
// NOTE:
// Paste this files content to a playground to experiment
//----------------------------------------------------------
import UIKit
func dateStr(_ format: String, date: Date = Date())-> String {
@ashikahmad
ashikahmad / remove_unexpected_repo_from_xcode_source_control.md
Last active June 17, 2022 18:55
Removing unexpected repository from XCode source control

Here are the steps that should work for you:

This steps are copied from pocketlogic's answer at StackOverflow

  1. Quit Xcode, and make a backup of your project file ( projectName.xcodeproj ).
  2. In Finder, right-click on your project file and select Show Package Contents.
  3. Right-click on the project.xcworkspace file, and select Show Package Contents.
  4. In the folder named xcshareddata, there is a file with the extension .xccheckout (it should have the same name as your main project file, but with the .xccheckout extension). Open the .xccheckout file in your favorite plain-text editor - this is a plist.
  5. Find the IDESourceControlProjectWCConfigurations key, and look for the <dict> that has the name of the repository that you want to remove. In the same \ there is a key IDESourceControlWCCIdentifierKey whose value contains an i
@ashikahmad
ashikahmad / ShellNinja.sh
Last active August 29, 2015 14:07
Some awesome tips and resources for smartly using shell. This are collected from here and there on internet. Basically it is for my own future reference as I forgot all the times :p
# ------------[ Shortcuts ]--------------
# tab => Complete argument
# ctrl+w => Delete last (w)ord
# ctrl+u => Delete whole line
# ctrl+k => Delete from cursor to end of line (kill)
# ctrl+a => Cursor back to start of line
# ctrl+l => C(l)ear Screen
# ctrl+r => Sea(r)ch for previous command
# ---------------------------------------