Skip to content

Instantly share code, notes, and snippets.

View anthonycastelli's full-sized avatar

Anthony anthonycastelli

View GitHub Profile
@patrickhammond
patrickhammond / android_instructions.md
Last active July 22, 2025 02:25
Easily setup an Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

@mmick66
mmick66 / UICollectionViewFlowLayoutCenterItem.m
Last active August 2, 2022 10:06
UICollectionViewFlowLayout with arbitrary sized Paging
#import "UICollectionViewFlowLayoutCenterItem.h"
@implementation UICollectionViewFlowLayoutCenterItem
- (CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentOffset withScrollingVelocity:(CGPoint)velocity
{
CGSize collectionViewSize = self.collectionView.bounds.size;
CGFloat proposedContentOffsetCenterX = proposedContentOffset.x + self.collectionView.bounds.size.width * 0.5f;
CGRect proposedRect = self.collectionView.bounds;
@okunishinishi
okunishinishi / Remove all git tags
Created March 8, 2014 03:12
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@pudquick
pudquick / notify.py
Last active September 3, 2023 16:51
Notification in pyobjc
# Banner-style (default)
from Foundation import NSUserNotification, NSUserNotificationCenter
def notify(title, subtitle, text):
notification = NSUserNotification.alloc().init()
notification.setTitle_(str(title))
notification.setSubtitle_(str(subtitle))
notification.setInformativeText_(str(text))
notification.setSoundName_("NSUserNotificationDefaultSoundName")
NSUserNotificationCenter.defaultUserNotificationCenter().scheduleNotification_(notification)
@umate
umate / image_uploader.rb
Last active December 3, 2023 03:05
CarrierWave gaussian blur filter using MiniMagick
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
version :blurred do
process :blur
end
def blur(radius=16)
manipulate! do |img|
original_path = img.path
@CodaFi
CodaFi / NUIColor.h
Last active June 16, 2021 22:31
Redoing NSColor for no reason whatsoever.
//
// NUIColor.h
// NUIKit
//
// Created by Robert Widmann on 9/21/13.
// Copyright (c) 2013 CodaFi. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
@aprato
aprato / AMPNavigationBar.m
Last active July 13, 2018 00:23
Darker iOS7 translucent UINavigationBar
// .h
@interface AMPNavigationBar : UINavigationBar
@property (nonatomic, assign) CGFloat extraColorLayerOpacity UI_APPEARANCE_SELECTOR;
@end
// .m
@alanzeino
alanzeino / Strong UINavigationBar colour
Last active April 26, 2020 23:34
Combining a strong colour with a blurred and translucent UINavigationBar in iOS 7.
// cheers to @stroughtonsmith for helping out with this one
UIColor *barColour = [UIColor colorWithRed:0.13f green:0.14f blue:0.15f alpha:1.00f];
UIView *colourView = [[UIView alloc] initWithFrame:CGRectMake(0.f, -20.f, 320.f, 64.f)];
colourView.opaque = NO;
colourView.alpha = .7f;
colourView.backgroundColor = barColour;
self.navigationBar.barTintColor = barColour;
#!/bin/sh
# FindInFile.sh
#
#
# Created by Gregory Hill on 2/28/13.
#
# Usage:
# ./FindInFile.sh <baseDir>
# e.g. ~/Desktop/Code/Pandora/dev/Pandora
@indragiek
indragiek / gist:5992951
Last active December 19, 2015 17:39
Compile date as NSDate
+ (NSDate *)compileDate
{
BOOL (^stringContainsQuestionMark)(NSString *) = ^BOOL (NSString *string) {
return [string rangeOfString:@"?"].location != NSNotFound;
};
NSMutableString *dateString = @(__DATE__).mutableCopy;
NSString *timeString = @(__TIME__);
if (stringContainsQuestionMark(dateString) || stringContainsQuestionMark(timeString)) {
return nil;