Skip to content

Instantly share code, notes, and snippets.

View jeksys's full-sized avatar

Eugene Yagrushkin jeksys

View GitHub Profile
- (CGImageRef)CGImageRotatedByAngle:(CGImageRef)imgRef angle:(CGFloat)angle
{
CGFloat angleInRadians = angle * (M_PI / 180);
CGFloat width = CGImageGetWidth(imgRef);
CGFloat height = CGImageGetHeight(imgRef);
CGRect imgRect = CGRectMake(0, 0, width, height);
CGAffineTransform transform = CGAffineTransformMakeRotation(angleInRadians);
CGRect rotatedRect = CGRectApplyAffineTransform(imgRect, transform);
@NachoMan
NachoMan / DataManager.h
Created April 15, 2011 21:15
Core Data singleton manager class capable of being run from a static library
// DataManager.h
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
extern NSString * const DataManagerDidSaveNotification;
extern NSString * const DataManagerDidSaveFailedNotification;
@interface DataManager : NSObject {
}
@jeksys
jeksys / gist:963263
Created May 9, 2011 19:58
Delegate template
@protocol SomeClassDelegate <NSObject>
- (void) SomeClassSelector:(ParamType*)param;
@end
@interface SomeClass : UIViewController {
id <SomeClassDelegate> delegate;
@jeksys
jeksys / gist:964506
Created May 10, 2011 13:50
List Of Fonts in the system
NSArray *names = [UIFont familyNames];
for (NSString *fontName in names) {
NSLog(@"%@:", fontName);
NSArray *fontnames = [UIFont fontNamesForFamilyName:fontName];
for (NSString *fontNameinFamily in fontnames) {
NSLog(@"-->%@", fontNameinFamily);
}
}
@nicklockwood
nicklockwood / ARCHelper.h
Last active November 20, 2018 10:02
ARC Helper
//
// ARC Helper
//
// Version 2.2
//
// Created by Nick Lockwood on 05/01/2012.
// Copyright 2012 Charcoal Design
//
// Distributed under the permissive zlib license
// Get the latest version from here:
@hiddenmemory
hiddenmemory / CoreData.m
Created February 2, 2012 16:50
SELECT name FROM SomeObject WHERE type = 'static' GROUP BY name [iOS5 Core Data ARC Remix]
- (NSArray*)listOfNames {
NSFetchRequest *request = [[NSFetchRequest alloc] init];
[request setEntity:[NSEntityDescription entityForName:@"SomeObject" inManagedObjectContext:self.managedObjectContext]];
[request setResultType:NSDictionaryResultType];
[request setPropertiesToFetch:[NSArray arrayWithObject:@"name"]];
[request setPropertiesToGroupBy:[NSArray arrayWithObject:@"name"]];
[request setPredicate:[NSPredicate predicateWithFormat:@"type = %@", @"static"]];
@jacobbubu
jacobbubu / ioslocaleidentifiers.csv
Created February 15, 2012 14:41
iOS Locale Identifiers
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)
@albertodebortoli
albertodebortoli / gist:2602966
Created May 5, 2012 14:39
JSON to NSManagedObject and viceversa (concept)
- (NSString*)jsonStructureFromManagedObjects:(NSArray*)managedObjects;
- (NSArray*)managedObjectsFromJSONStructure:(NSString*)json withManagedObjectContext:(NSManagedObjectContext*)moc;
- (NSDictionary*)dataStructureFromManagedObject:(NSManagedObject*)managedObject
{
NSDictionary *attributesByName = [[managedObject entity] attributesByName];
NSDictionary *relationshipsByName = [[managedObject entity] relationshipsByName];
NSMutableDictionary *valuesDictionary = [[managedObject dictionaryWithValuesForKeys:[attributesByName allKeys]] mutableCopy];
[valuesDictionary setObject:[[managedObject entity] name] forKey:@"ManagedObjectName"];
for (NSString *relationshipName in [relationshipsByName allKeys]) {
@turtlesoupy
turtlesoupy / SFSSmokeScreen.m
Created September 16, 2012 08:50
Psychedelic smoke CAEmitterLayer particle effect
#import "SFSSmokeScreen.h"
#import <QuartzCore/QuartzCore.h>
@implementation SFSSmokeScreen {
__weak CAEmitterLayer*smokeEmitter;
}
-(id)initWithFrame:(CGRect)frame emitterFrame:(CGRect)emitterFrame{
if ((self = [super initWithFrame:frame])) {
self.backgroundColor = [UIColor clearColor];
@KWMalik
KWMalik / interviewitems.MD
Created September 16, 2012 22:04 — forked from amaxwell01/interviewitems.MD
My answers to over 100 Google interview questions

##Google Interview Questions: Product Marketing Manager

  • Why do you want to join Google? -- Because I want to create tools for others to learn, for free. I didn't have a lot of money when growing up so I didn't get access to the same books, computers and resources that others had which caused money, I want to help ensure that others can learn on the same playing field regardless of their families wealth status or location.
  • What do you know about Google’s product and technology? -- A lot actually, I am a beta tester for numerous products, I use most of the Google tools such as: Search, Gmaill, Drive, Reader, Calendar, G+, YouTube, Web Master Tools, Keyword tools, Analytics etc.
  • If you are Product Manager for Google’s Adwords, how do you plan to market this?
  • What would you say during an AdWords or AdSense product seminar?
  • Who are Google’s competitors, and how does Google compete with them? -- Google competes on numerous fields: --- Search: Baidu, Bing, Duck Duck Go