Skip to content

Instantly share code, notes, and snippets.

View olexth's full-sized avatar

Olex olexth

  • Available for hire
  • Ukraine, Kyiv
View GitHub Profile
NSDateComponents *dateComponents = [[NSCalendar currentCalendar] components:NSCalendarUnitHour fromDate:[NSDate date]];
if (dateComponents.hour >= 9 && dateComponents.hour < 21)
{
// display local notifications
}
@olexth
olexth / Objective-C declension in russian language
Last active August 29, 2015 13:55
Declension for words in russian language depending on count between current word. More about declension: http://en.wikipedia.org/wiki/Russian_grammar#Declension_of_numerals
- (NSString *)stringFromCount:(NSUInteger)count
{
NSString *days = nil;
NSUInteger modulo10 = count % 10;
if (modulo10 == 1)
{
days = NSLocalizedString(@"день", nil);
}
if (modulo10 == 2 || modulo10 == 3 || modulo10 == 4)
{