Skip to content

Instantly share code, notes, and snippets.

View eldesperado's full-sized avatar
😁
I am busy being happy

Trung Pham eldesperado

😁
I am busy being happy
View GitHub Profile
@lantrix
lantrix / IMStatus.scpt
Created January 3, 2011 12:55
Applescript to tell Adium, Skype and iChat to change their status simultaneously
-- IMStatus
-- version 2.0, Lantrix (http://techdebug.com)
-- idea conceived from script by Jason Kenison "theWebGuy" Blog at:
-- http://www.jasonkenison.com/blog.html?id=22
(*
Copyright (c) 2008, TechDebug.com
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@elango
elango / gist:2786186
Created May 25, 2012 06:37 — forked from ksm/gist:1875946
CALayer shadowPath done the right way
/*
Source: Apple Developer - Understanding iOS View Compositing
*/
// setup the layer
CALayer *layer = view.layer;
layer.bounds = sublayer_bounds;
layer.backgroundColor = random_color();
// set the shadow properties on the layer
@idStar
idStar / UWFacebookService.m
Created August 30, 2012 16:47
Facebook Utility class to determine if logged in or not
#import "UWFacebookService.h"
@implementation UWFacebookService
// Static
static const int ddLogLevel = LOG_LEVEL_DEBUG;
// Strong
@synthesize facebookGraphUser = _facebookGraphUser;
@lessthanyouthink
lessthanyouthink / CJProperRotationNavigationController.h
Created October 5, 2012 20:27
A simple UINavigationController subclass to handle iOS 6's orientation changes better.
//
// CJProperRotationNavigationController.h
//
// Created by Charles Joseph on 2012-10-01.
//
#import <UIKit/UIKit.h>
@interface CJProperRotationNavigationController : UINavigationController
@romyilano
romyilano / merge2Images.m
Created December 21, 2012 22:03
Merge 2 Images into one image / iOS
// source
// http://stackoverflow.com/questions/9257992/how-to-combine-merge-2-images-into-1
- (UIImage*)imageByCombiningImage:(UIImage*)firstImage withImage:(UIImage*)secondImage {
UIImage *image = nil;
CGSize newImageSize = CGSizeMake(MAX(firstImage.size.width, secondImage.size.width), MAX(firstImage.size.height, secondImage.size.height));
if (UIGraphicsBeginImageContextWithOptions != NULL) {
UIGraphicsBeginImageContextWithOptions(newImageSize, NO, [[UIScreen mainScreen] scale]);
} else {
UIGraphicsBeginImageContext(newImageSize);
@krzysztofzablocki
krzysztofzablocki / gist:4396302
Last active November 24, 2021 19:17
Set symbol breakpoint on objc_msgSend then setup this debug command to log all methods called in iOS Simulator. If you want to do device debugging change esp+4 register to r0, esp+8 to r1 Found long ago somewhere on stackoverflow.
expr -- (void)printf("[%s, %s]\n",(char *) object_getClassName(*(long*)($esp+4)), (char *) *(long *)($esp+8) )
@ryansobol
ryansobol / gist:5252653
Last active November 22, 2023 11:53
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

public class AnimatedActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
//opening transition animations
overridePendingTransition(R.anim.activity_open_translate,R.anim.activity_close_scale);
}
@appsandwich
appsandwich / gist:6007702
Created July 16, 2013 10:50
iOS - Simulate on-device memory warnings using volume button press
#if DEBUG
#import <MediaPlayer/MediaPlayer.h>
#endif
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
#if DEBUG
// Debug code that lets us simulate memory warnings by pressing the device's volume buttons.
@jwilling
jwilling / JNWThrottledBlock.h
Last active October 26, 2020 17:02
Simple throttling of blocks using dispatch sources.
#import <Foundation/Foundation.h>
@interface JNWThrottledBlock : NSObject
// Runs the block after the buffer time _only_ if another call with the same identifier is not received
// within the buffer time. If a new call is received within that time period the buffer will be reset.
// The block will be run on the main queue.
//
// Identifier and block must not be nil.
+ (void)runBlock:(void (^)())block withIdentifier:(NSString *)identifier throttle:(CFTimeInterval)bufferTime;