Skip to content

Instantly share code, notes, and snippets.

View thaboklass's full-sized avatar

Thabo David Nyakallo Klass thaboklass

View GitHub Profile
<?php
/**
* Sanitize widget form values as they are saved.
*
* @see WP_Widget::update()
*
* @param array $new_instance Values just sent to be saved.
* @param array $old_instance Previously saved values from database.
*
* @return array Updated safe values to be saved.
<?php
/**
* Back-end widget form.
*
* @see WP_Widget::form()
*
* @param array $instance Previously saved values from database.
*/
public function form($instance) {
<?php
function __construct() {
// This adds backend options that define the basic
// functionality
$this->robber_baron_tv_add_options();
// Initialize it to false
$this->robber_baron_tv_is_in_footer = false;
// Get the user_id
@thaboklass
thaboklass / CalculateStorageUsage.swift
Last active August 12, 2019 10:18
How To Programmatically Measure Usage On Firebase Cloud Storage
/// The current user
var currentUser: String? = KeychainWrapper.standard.string(forKey: ApplicationConstants.userIDKey)
// This stores the names of the file stored in Firebase Storage
var userFiles = [String]()
// This count the size of the files in bytes
var userFilesTotalSize: Int64 = 0
override func viewDidLoad() {
@thaboklass
thaboklass / SpreebieSNSExample-Bridging-Header.h
Created August 12, 2019 01:00
SpreebieSNSExample Bridging Header
//
// SpreebieSNSExample-Bridging-Header.h
// SpreebieSNSExample
//
// Created by Thabo David Klass on 26/08/2017.
// Copyright © 2017 Open Beacon. All rights reserved.
//
#ifndef SpreebieSNSExample_Bridging_Header_h
#define SpreebieSNSExample_Bridging_Header_h
@thaboklass
thaboklass / AppDelegate.swift
Created August 12, 2019 00:58
The SpreebieSNSExample AppDelegate
//
// AppDelegate.swift
// SpreebieSNSExample
//
// Created by Thabo David Klass on 26/08/2017.
// Copyright © 2017 Open Beacon. All rights reserved.
//
import UIKit
import AWSSNS
@thaboklass
thaboklass / strip_unwanted_arch.sh
Created August 11, 2019 07:56
Strip unwanted architectures in iOS frameworks before App Store Connect submission.
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"