Skip to content

Instantly share code, notes, and snippets.

@sgtsquiggs
sgtsquiggs / UIColor+iOS7NavigationBar_Expanded.m
Last active December 26, 2015 20:09
Equivalent color w/ alpha for UINavigationBar's barTintColor
@implementation UIColor (iOS7NavigationBar_Expanded)
// Returns equivelent color with alpha nearest to minimum alpha
- (UIColor *) equivalentNonOpaqueColorWhenInterpolatedWithBackgroundColor: (UIColor *)backgroundColor minimumAlpha: (CGFloat) alpha
{
NSAssert(self.canProvideRGBComponents, @"Self must be a RGB color to use arithmatic operations");
NSAssert(backgroundColor.canProvideRGBComponents, @"Self must be a RGB color to use arithmatic operations");
NSAssert(self.alpha == 1, @"Self must be an opaque RGB color");
NSAssert(backgroundColor.alpha == 1, @"Background color must be an opaque RGB color");
CGFloat r, g, b, a;

#BAPrayerTimes

BAPrayerTimes is an Objective-C library for calculating Islamic prayer times. It provides a convenient Objective-C interface to the ITL prayer times library, making it easy to correctly calculate prayer times in iOS and OS X.

##ITL The Islamic Tools and Libraries (ITL) is a widely used library for useful Islamic tools written in C. It is an open source projects maintained by the arabeyes organization. Being written in C allows it to have high precision and be very efficient. It is used in many popular Linux utilities and is the source of prayer time calculation for this library.

##Installation The simplest way to use BAPrayerTimes is with CocoaPods.

@sgtsquiggs
sgtsquiggs / public.key
Created September 2, 2014 20:40
sgt@squig.gs public key
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBFKS9kgBCACkPRg1SJyGefwAG8felaYg2dGyjcX+A4hd3rPMP6qrD91hrVLO
da1wvouGJaLFddoDiQuEbMb74y4bdPKyqpeI6tjeG1xTT635PoAw4Tnp9gM29o1G
K7ElABjN9PWCeVlwirWvA6VksRcRj8HpBsy6RRccXut0vWumc69WXtC2m1E6ywgO
0MmOZ4lWXDIt+pyPvvNM2brAOwK5jSHdf5dvrLZ6HWNI2UX0uvKlOOc8abjWXaYQ
wGFf6+KhnbqP3ub8apfH6ShKq9109rVhIqV00nQ//VtCajbE1iqG2xlZ0VDRznIX
lMBZYuLnIB2KmToDbUMgJ4aOtTa1aSWLUb5dABEBAAG0H01hdHRoZXcgQ3JlbnNo
YXcgPHNndEBzcXVpZy5ncz6JAT0EEwEKACcFAlKS9kgCGwMFCQeGH4AFCwkIBwMF
FQoJCAsFFgIDAQACHgECF4AACgkQRxLSGgsOqZT1KAf/arrLr3GbxBCx1UU8Vojc
hskKQdl6ZcEZ4nCaJJ726AFPtLbR3nsOhL5gSh5t/xgtt9F+91unktybl3k/h1iX
@sgtsquiggs
sgtsquiggs / MySQL_REBUILD_LIVE_SLAVE_from_MASTER.sh
Last active May 18, 2018 06:22
MySQL_REBUILD_LIVE_SLAVE_from_MASTER
#!/usr/bin/env bash
# Name: MySQL_REBUILD_LIVE_SLAVE_from_MASTER
# Purpose: Rebuilds live all Databases of a replication SLAVE based on a good running MASTER
# This rebuilt action is done without stopping the MASTER MySQL server or even locking the tables
# or the destination server (SLAVE)
# Syntax: MySQL_REBUILD_LIVE_SLAVE_from_MASTER Master:Port Slave:Port {F|P}
# eg. MySQL_REBUILD_LIVE_SLAVE_from_MASTER db1:3306 www1:3306 P
# {F|P} - Dump method F) Uses a full temporary dump file method P) Uses the pipe method
# Note: In some situation where the databases are very big (GB) the Pipe (P) method might not work well
# In these case it is recommended to use the File(F) method
@sgtsquiggs
sgtsquiggs / ARAnalyticsLogger.h
Last active August 29, 2015 14:15
ARAnalyticsLogger
//
// ARAnalyticsLogger.h
//
// Created by Matthew Crenshaw on 2/12/15.
// Copyright (c) 2015 Batoul Apps. All rights reserved.
//
#import <CocoaLumberjack/DDLog.h>
@interface ARAnalyticsLogger : DDAbstractLogger
@sgtsquiggs
sgtsquiggs / keybase.md
Created February 24, 2015 23:04
Keybase.io Verification

Keybase proof

I hereby claim:

  • I am sgtsquiggs on github.
  • I am sgtsquiggs (https://keybase.io/sgtsquiggs) on keybase.
  • I have a public key whose fingerprint is C5E6 CDA3 BB97 829F AAA1 6E68 4712 D21A 0B0E A994

To claim this, I am signing this object:

@sgtsquiggs
sgtsquiggs / showmethefonts.m
Created August 18, 2015 16:29
show me the fonts
#ifdef SHOW_ME_THE_FONTS
for (NSString *familyName in [UIFont familyNames]){
NSLog(@"Family name: %@", familyName);
for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]) {
NSLog(@"--Font name: %@", fontName);
}
}
#endif
@sgtsquiggs
sgtsquiggs / game.py
Created February 1, 2016 22:20
TIC TAC TOE
import random
def draw_board(board):
print(' | |')
print(' %s | %s | %s' % (board[1], board[2], board[3]))
print(' | |')
print('---+---+---')
print(' | |')
print(' %s | %s | %s' % (board[4], board[5], board[6]))
@sgtsquiggs
sgtsquiggs / new_relic_system_monitor.ebextensions.config
Last active July 29, 2016 16:08
New Relic Server Monitoring on Elastic Beanstalk
# installs and configures New Relic System Monitoring agent
# https://crondev.com/new-relic-server-monitoring-on-elastic-beanstalk/
# requires `AmazonEC2ReadOnlyAccess` policy to get eb environment name
#
files:
"/opt/elasticbeanstalk/get-eb-env-name.py":
mode: "000755"
owner: root
group: root
content: |
@sgtsquiggs
sgtsquiggs / download_devices.rb
Created December 13, 2016 16:55
Fastlane action to download device UDIDs for the current team
module Fastlane
module Actions
class DownloadDevicesAction < Action
def self.run(params)
require 'spaceship'
ship = Spaceship::Portal.login(ENV['DELIVER_USER'], ENV['DELIVER_PASSWORD'])
ship.team_id = CredentialsManager::AppfileConfig.try_fetch_value(:team_id)
devices = ship.devices