Skip to content

Instantly share code, notes, and snippets.

View pronebird's full-sized avatar

Andrej Mihajlov pronebird

View GitHub Profile
@pronebird
pronebird / UISearchBarInTableHeaderBackgroundColorFix.m
Last active August 29, 2015 14:01
Background color fix for stub view positioned between table view top edge and UISearchBar as header view
//
// Fix background color bug
// This patch can be applied once in viewDidLoad if you use UITableViewController
// http://stackoverflow.com/q/23026531/351305
//
- (void)_fixSearchBarHeaderViewBackgroundColorBug {
// First subview in UITableView is a stub view positioned between table's top edge and table's header view.
UIView* stubView = [self.tableView.subviews firstObject];
// Make sure it's stub view and not anything else
On branch master
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: Library/Aliases/hugs
deleted: Library/Aliases/saga
modified: Library/Contributions/brew_bash_completion.sh
modified: Library/Contributions/brew_fish_completion.fish
modified: Library/Contributions/brew_zsh_completion.zsh
@pronebird
pronebird / gist:c3dde8c25938c35c1ab8
Last active August 29, 2015 14:05
Draw arrow with rounded corners using CoreGraphics
@implementation UIImage (Arrow)
+ (UIImage*)arrowImageWithSize:(CGFloat)arrowSize withColor:(UIColor*)arrowColor thickness:(CGFloat)thickness
{
//
// Create bezier path for arrow
//
// +---+-------+-+
// | |
// | +
@pronebird
pronebird / carousel.css
Last active August 29, 2015 14:07
Bootstrap 2.3.2 carousel performance patch
@pronebird
pronebird / mobile-safari-addressbar-help-tip.js
Created October 27, 2014 14:32
Show a help tip how to hide navigation bars on Mobile Safari when in landscape
//
// A helper function to toggle a help tip
// about how to hide Safari address bar when it's visible
// Monitors only landscape mode and works on Safari on iOS 8+
//
// This is a part of my post on Coderwall: https://coderwall.com/p/yaro4w
//
var attachMobileSafariAddressBarHelpTip = function (target) {
var $target = $(target);
$target.tooltip({
@pronebird
pronebird / ios-screenlock-detector.js
Last active August 29, 2015 14:08
iOS 8 standalone apps screen lock detector
//
// Detect screenlock on standalone ios apps and replace content with message to reload the app
// When user locks screen on iOS 8 devices, everything dies except web workers
// This will definitely drain battery.
// Based on the idea by ajayel: http://stackoverflow.com/a/26091749/351305
//
(function () {
var WORKER_URI = '/app/worker.js';
var TIMEOUT = 2000;
@pronebird
pronebird / js.js
Created November 7, 2014 21:57
js2coffee test JS for "for" loops
// if statements
for(var i = 0; i < 5; i++) {
if(i == 0) {
continue; // if body
}
else if(i == 1) continue; // inline else+if
else continue; // inline else
for(var j = 0; j < 2; j++)
for(var k = 0; k < 4; k++)
@pronebird
pronebird / Example.m
Last active August 29, 2015 14:16
JDStatusBarNotification+Queue category
// Create statusbar activity per upload
JDStatusBarActivity* upload1 = [JDStatusBarActivity new];
upload1.styleName = JDStatusBarStyleDark;
upload1.message = @"Uploading file #1";
JDStatusBarActivity* upload2 = [JDStatusBarActivity new];
upload2.styleName = JDStatusBarStyleDark;
upload2.message = @"Uploading file #2";
// Add activities to status bar
//
// main.m
//
#import <UIKit/UIKit.h>
#import <pop/POP.h>
#import "AppDelegate.h"
static CGFloat deceleration_for_distance(CGFloat distance, CGFloat velocity)
{
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script src="https://raw.githubusercontent.com/konvajs/konva/master/konva.min.js"></script>
</head>
<body>
<label><input type="checkbox" value="yes" id="disableHitFromCache" /> Disable drawHitFromCache</label>
<div id="konva" style="width: 300px; height: 300px;"></div>