Skip to content

Instantly share code, notes, and snippets.

View vicc's full-sized avatar

Vicc Alexander vicc

View GitHub Profile
#!/bin/bash
# Logout current GitHub credentials and remove global user.name, user.email
echo -e "host=github.com\nprotocol=https\n" | git credential-osxkeychain erase
git config --unset-all --global user.name
git config --unset-all --global user.email
@vicc
vicc / timerModule.js
Last active January 21, 2016 05:59
Timer Module to easily log execution times for functions, promises, etc. on Parse Cloud Code
/*
The Timer Module makes it easy to analyze how long each
of your functions, promises, etc. are taking in Cloud
Code.
Although NSDate.getTime() isn't as accurate as other modern
approaches (e.g console.time, performance.now) it is still
quite helpful.
@patricklynch
patricklynch / gist:689525d466c4ada42b8e
Last active October 30, 2021 05:23
The 6 ways to unwrap optionals in Swift 2.0
// The 6 ways to uwnrap optionals in Swift 2.0
//
// Created by Patrick Lynch on 6/28/15.
// Copyright © 2015 Patrick Lynch. All rights reserved.
import Foundation
// 1. Force Unwrapping
// 2. Optional Binding
// 3. Optional Chaining
class LinearSVC_proba(LinearSVC):
def __platt_func(self,x):
return 1/(1+np.exp(-x))
def predict_proba(self, X):
f = np.vectorize(self.__platt_func)
raw_predictions = self.decision_function(X)
platt_predictions = f(raw_predictions)
probs = platt_predictions / platt_predictions.sum(axis=1)[:, None]
@michaelpeternell
michaelpeternell / ios7_statusbar_textcolor
Last active July 15, 2020 17:58
Change the text color of the status bar on iPhone and iPad (works for iOS 7 - iOS 12)
/// sets the status bar text color. returns YES on success. currently, this only
/// works in iOS 7. It uses undocumented, inofficial APIs.
BOOL setStatusBarColor(UIColor *color)
{
id statusBarWindow = [[UIApplication sharedApplication] valueForKey:@"statusBarWindow"];
id statusBar = [statusBarWindow valueForKey:@"statusBar"];
SEL setForegroundColor_sel = NSSelectorFromString(@"setForegroundColor:");
if([statusBar respondsToSelector:setForegroundColor_sel]) {
// iOS 7+
@cwagdev
cwagdev / UIColor+Grayscale.h
Created August 2, 2013 09:11
Convert a UIColor color to its grayscale equivalent
#import <UIKit/UIKit.h>
@interface UIColor (Grayscale)
- (UIColor *)grayscale;
@end
@mattt
mattt / uiappearance-selector.md
Last active June 4, 2024 13:28
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 3

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
 sed 's/UI_APPEARANCE_SELECTOR//g' | \
@dhoerl
dhoerl / KeychainItemWrapper.h
Last active April 4, 2023 08:15
KeychainItemWrapper ARCified. Added the ability to manage a dictionary in place of just a string - the #define PASSWORD_USES_DATA in the .m file switches the mode.
/*
File: KeychainItemWrapper.h
Abstract:
Objective-C wrapper for accessing a single keychain item.
Version: 1.2 - ARCified
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of