Skip to content

Instantly share code, notes, and snippets.

View Akhrameev's full-sized avatar

Pavel Akhrameev Akhrameev

  • Picsart
  • Yerevan, Armenia
View GitHub Profile
@mikeash
mikeash / gist:1355671
Created November 10, 2011 18:28
Multiple return
// clang -W -Wall -Wno-unused-parameter -framework Foundation -fobjc-arc test.m
#import <Foundation/Foundation.h>
#define IDARRAY(...) ((id[]){ __VA_ARGS__ })
#define IDCOUNT(...) (sizeof(IDARRAY(__VA_ARGS__)) / sizeof(id))
typedef id (^Tuple)(int);
@jehiah
jehiah / increment_build_number.sh
Created December 6, 2011 03:37
Auto-increment build number script for Xcode
TARGET="$PROJECT_DIR/project/Info.plist"
echo $TARGET
if [ ! -f "$TARGET" ]; then
echo "missing file $TARGET"
exit 1;
fi
# the perl regex splits out the last part of a build number (ie: 1.1.1) and increments it by one
# if you have a build number that is more than 3 components, add a '\.\d+' into the first part of the regex.
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
@interface NSNotificationCenter (AllObservers)
- (NSSet *) my_observersForNotificationName:(NSString *)notificationName;
@end
@sekati
sekati / xcode-build-bump.sh
Created July 24, 2012 20:44
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@vgrichina
vgrichina / CellBackgroundView.h
Created November 12, 2012 21:39
Customizable background view for UITableViewCell in grouped table view
//
// CellBackgroundView.h
//
//
#import <UIKit/UIKit.h>
typedef enum {
CellPositionTop,
CellPositionMiddle,
@enigmaticape
enigmaticape / part1.m
Created November 14, 2012 19:59
You want to use NSObject performSelector with multiple parameters, but you can't ? (1)
- ( id ) methodWithOneParam:( id ) theParam {
// Do amazing stuff
return @"Srsly, Amazing!";
}
- ( id ) methodWithFirst:( id ) firstParam
andSecond:( id ) secondParam
{
// Do doubly amazing stuff
@luca-bernardi
luca-bernardi / AVAsset+VideoOrientation.h
Created February 23, 2013 18:12
Find the video orientation of an AVAsset. (Useful if you need to send the video to a remote server)
//
// AVAsset+VideoOrientation.h
//
// Created by Luca Bernardi on 19/09/12.
// Copyright (c) 2012 Luca Bernardi. All rights reserved.
//
#import <AVFoundation/AVFoundation.h>
typedef enum {
LBVideoOrientationUp, //Device starts recording in Portrait
@ShadoFlameX
ShadoFlameX / custom_callouts.md
Last active May 20, 2018 14:14
Custom Map Annotation Callouts on iOS
  1. Create a UIView subclass for the pin callout view.
  2. Create a subclass of MKAnnotationView for your map pins.
  3. Add an instance of the callout view subclass to your MKAnnotationView subclass.
  4. Add a property to toggle the callout view to your MKAnnotationView subclass. This example fades in/out:
    - (void)setShowCustomCallout:(BOOL)showCustomCallout
    {
        [self setShowCustomCallout:showCustomCallout animated:NO];
    }
    
@maddiesch
maddiesch / DrawView.h
Created December 3, 2013 21:50
Simple drawing view based on UIPanGestureRecognizer.
#import <UIKit/UIKit.h>
@interface DrawView : UIView
@property (nonatomic) CGMutablePathRef drawingPath;
@property (nonatomic) CGPoint lastPoint;
@end
require 'rss/2.0'
require 'cgi'
require 'net/http'
host = Net::HTTP.new('bash.im', 443)
host.use_ssl = true
resp = host.get('https://bash.im/rss/')
data = resp.body
parsed = RSS::Parser.parse(data.gsub(/\<hr\>/, '<hr/>'), false)
parsed.items.each { |x| puts CGI::unescapeHTML(x.description.gsub("\n", "").gsub("<br>", "\n")); puts "%\n" }