Skip to content

Instantly share code, notes, and snippets.

View mojtabacazi's full-sized avatar

Mojtaba Cazi mojtabacazi

View GitHub Profile
@mojtabacazi
mojtabacazi / UIScrollView+ContentOffset.m
Created March 31, 2016 17:32
Changing UIScrollView contentOffset without triggering scrollViewDidScroll:
CGPoint desiredContentOffset = <#content offset#>;
CGRect scrollBounds = scrollView.bounds;
scrollBounds.origin = desiredContentOffset;
scrollView.bounds = scrollBounds;
@mojtabacazi
mojtabacazi / UIViewController.m
Last active June 30, 2016 19:18
Boilerplate code for NSFetchedResultsController and UITableView
@interface ViewController () <UITableViewDelegate, UITableViewDataSource, NSFetchedResultsControllerDelegate>
@property (nonatomic, weak) IBOutlet UITableView *tableView;
@property (nonatomic, strong) NSFetchedResultsController *fetchController;
@end
@implementation ViewController
@mojtabacazi
mojtabacazi / git-insert-init.txt
Created November 29, 2016 21:09
Inserting a commit before git initial commit.
# first you need a new empty branch; let's call it `newroot`
git checkout --orphan newroot
git rm -rf .
# then you apply the same steps
git commit --allow-empty -m 'root commit'
git rebase --onto newroot --root master
git branch -d newroot
@mojtabacazi
mojtabacazi / main.m
Last active June 28, 2017 07:07
Find Unused Headers
//
// main.m
// Unsused Import Finder
//
// Created by Mojtaba Cazi on 6/27/17.
// Copyright © 2017 CaziSoft, LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
@mojtabacazi
mojtabacazi / MacOS.ahk
Created March 29, 2018 15:45
OSX like keyboard. Left Keys: Win/Alt/Ctrl. Right: Ctrl/ Alt
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
RAlt::RCtrl
LAlt::LCtrl
LCtrl::LWin
RCtrl::RAlt