Skip to content

Instantly share code, notes, and snippets.

View densa's full-sized avatar
🇺🇦
UKE

Denys Sedura densa

🇺🇦
UKE
View GitHub Profile
@andreyvit
andreyvit / UIPickerView_SelectionBarLabelSupport.h
Created October 23, 2009 01:08
UIPickerView category that allows to easily recreate the look and feel of UIDatePicker labeled components (HIG calls them “translucent bar labels”)
// UIPickerView_SelectionBarLabelSupport.h
//
// This file adds a new API to UIPickerView that allows to easily recreate
// the look and feel of UIDatePicker labeled components.
//
// Copyright (c) 2009, Andrey Tarantsov <andreyvit@gmail.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
// copyright notice and this permission notice appear in all copies.
@gampleman
gampleman / board.css
Created November 5, 2010 15:36
CSS to make a Departure board
#4606367513 {
padding: 5px 10px;
display: inline-block;
background: rgb(30, 30, 30);
background: -webkit-gradient(linear, center top, center bottom,
color-stop(0.0, rgba(0,0,0, 1)),
color-stop(0.05, rgba(30,30,30, 1)),
color-stop(1.0, rgba(50, 50, 60, 1)));
background: -moz-linear-gradient(270deg,
rgba(0,0,0,1) 0%,
@osteslag
osteslag / IR_Black.dvtcolortheme
Created February 20, 2011 10:54
IR_Black theme for Xcode 4, based on IR_Black for Xcode 3 by David Zhou, based on IR_Black for TextMate by Todd Werth. See links in comments below.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>0.811765 0.796078 0.564706 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>Inconsolata - 16.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>1 1 1 1</string>
@darkseed
darkseed / Curved_shadow.m
Created May 11, 2011 22:13
Curved shadow below an image
#import <QuartzCore/QuartzCore.h>
- (void)viewDidLoad
{
[super viewDidLoad];
UIImage *image = [UIImage imageNamed:@"photo.png"];
UIView *photoView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, image.size.width, image.size.height)];
photoView.center = CGPointMake(self.view.center.x, self.view.center.y - 10);
@oleganza
oleganza / NSData+OADataHelpers.m
Last active December 9, 2022 03:50
Creating NSString from NSData by fixing invalid UTF8 characters
// Author: Oleg Andreev <oleganza@gmail.com>
// May 28, 2011
// Do What The Fuck You Want Public License <http://www.wtfpl.net>
#import "NSData+OADataHelpers.h"
#if !__has_feature(objc_arc)
#error ARC must be enabled!
#endif
@zachwaugh
zachwaugh / gist:1151687
Created August 17, 2011 14:53
Image mask
- (UIImage *)imageWithMask:(UIImage *)maskImage andIsWhite:(BOOL)isWhite
{
CGRect imageRect = CGRectMake(0, 0, maskImage.size.width, maskImage.size.height);
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef ctx = CGBitmapContextCreate(NULL, maskImage.size.width, maskImage.size.height, 8, 0, colorSpace, kCGImageAlphaPremultipliedLast);
CGContextClipToMask(ctx, imageRect, maskImage.CGImage);
if (isWhite) {
CGContextSetRGBFillColor(ctx, 1, 1, 1, 1);
} else {
@javan
javan / gist:1168475
Created August 24, 2011 16:32
Fix iPhone home button
Found this tip in comment here: http://www.tipb.com/2011/01/04/tipb-bug-home-button-working-iphone/
1.) Open any application
2.) Press and hold the power button until the slide to shutdown swipe bar appears.
3.) Release Power button
4.) Press and hold Home button Lightly
until screen returns to icon screen
@wearhere
wearhere / keep_current_file_open.sh
Created February 9, 2012 09:34
Keep your current source file open in Xcode after a run completes (a.k.a don't die in main.m)
#! /bin/sh
# On alternate invocations, this script
# saves the path of the source file currently open in Xcode
# and restores the file at that path in Xcode.
#
# By setting Xcode (in Behaviors) to run this script when "Run Starts"
# and when "Run Completes", you can prevent it from switching to main.m
# when a run finishes.
# See http://stackoverflow.com/questions/7682277/xcode-4-2-jumps-to-main-m-every-time-after-stopping-simulator
@farcaller
farcaller / gist:1801278
Created February 11, 2012 15:56
Refactored macros from bitbucket.org/snej/myutilities
#define $array(OBJS...) ({id objs[]={OBJS}; \
[NSArray arrayWithObjects: objs count: sizeof(objs)/sizeof(id)];})
#define $marray(OBJS...) ({id objs[]={OBJS}; \
[NSMutableArray arrayWithObjects: objs count: sizeof(objs)/sizeof(id)];})
#define $mdict(PAIRS...) ( \
{id pairs[]={PAIRS}; \
NSMutableDictionary *d = [NSMutableDictionary dictionary]; \
int cnt = sizeof(pairs)/sizeof(id); \
@nielsbot
nielsbot / UIImage+JPEG2000.h
Created February 19, 2012 00:43
Decoding JPEG 2000 files to UIImage
#import <Foundation/Foundation.h>
extern UIImage * UIImageWithJPEG2000Data( NSData * data ) ;