Skip to content

Instantly share code, notes, and snippets.

View justinmfischer's full-sized avatar
🎯
Focusing

Justin Fischer justinmfischer

🎯
Focusing
View GitHub Profile
@justinmfischer
justinmfischer / combineDateWithTime
Last active October 6, 2021 13:22
Combine date and time into a single NSDate in Swift 2.0
func combineDateWithTime(date: NSDate, time: NSDate) -> NSDate? {
let calendar = NSCalendar.currentCalendar()
let dateComponents = calendar.components([.Year, .Month, .Day], fromDate: date)
let timeComponents = calendar.components([.Hour, .Minute, .Second], fromDate: time)
let mergedComponments = NSDateComponents()
mergedComponments.year = dateComponents.year
mergedComponments.month = dateComponents.month
mergedComponments.day = dateComponents.day
@pgilad
pgilad / Instructions.md
Last active March 31, 2024 22:30
Git commit-msg hook to validate for jira issue or the word merge

Instructions

  • copy the file commit-msg to .git/hooks/commit-msg
  • make sure your delete the sample file .git/hooks/commit-msg.sample
  • Make commit msg executable. chmod +x .git/hooks/commit-msg
  • Edit commit-msg to better fit your development branch, commit regex and error message
  • Profit $$

Shell example

@kevin-smets
kevin-smets / iterm2-solarized.md
Last active November 14, 2024 15:40
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@justinmfischer
justinmfischer / roundDateTo5Minutes
Last active December 26, 2015 22:09
Round Date To 5 Minutes
+ (NSDate *) roundDateTo5Minutes:(NSDate *) mydate {
NSDateComponents *time = [[NSCalendar currentCalendar] components:NSHourCalendarUnit | NSMinuteCalendarUnit fromDate:mydate];
NSInteger minutes = [time minute];
int remain = minutes % 5;
if (remain < 3){
mydate = [mydate dateByAddingTimeInterval:-60 * (remain)];
}else{
mydate = [mydate dateByAddingTimeInterval:60 * (5-remain)];