Skip to content

Instantly share code, notes, and snippets.

View bballentine's full-sized avatar

Brandon Ballentine bballentine

View GitHub Profile
@kkirsche
kkirsche / Install Composer to use MAMP's PHP.md
Last active January 30, 2024 02:30
How to install Composer globally using MAMP's PHP

##Create an alias to MAMP's PHP installation

To do this, we can simply create an alias for our bash profile. We'll be doing this is nano, though you can do it in vim or a number of other editors as well.

Within the terminal, run:

nano ~/.bash_profile

This will open nano with the contents, at the top in a blank line add the following line:

@abemedia
abemedia / google-cse-bootstrap.less
Created October 27, 2015 05:06
Google Custom Search Bootstrap Theme
/* Google Custom Search - Bootstrap Theme
-------------------------------------------------- */
@gs-title-size: @font-size-h4;
@gs-url-color: @brand-success;
@gs-thumbnail-size: 90px;
/* Search Form
//
// UIBarButtonItem+Badge.swift
// PiGuardMobile
//
// Created by Stefano Vettor on 12/04/16.
// Copyright © 2016 Stefano Vettor. All rights reserved.
//
import UIKit
@cmoulton
cmoulton / URLSession Calls in Swift 3.0.1
Last active November 4, 2022 00:29
URLSession Calls in Swift 3.0.1
func makeGetCall() {
// Set up the URL request
let todoEndpoint: String = "https://jsonplaceholder.typicode.com/todos/1"
guard let url = URL(string: todoEndpoint) else {
print("Error: cannot create URL")
return
}
let urlRequest = URLRequest(url: url)
// set up the session
@nor0x
nor0x / UICollectionView + NSFetchedResultsController.swift
Last active March 21, 2021 12:52 — forked from nazywamsiepawel/UICollectionView + NSFetchedResultsController.swift
UICollectionView + NSFetchedResultsController Swift 3 / iOS 10
var _fetchedResultsController: NSFetchedResultsController<Entity>? = nil
var blockOperations: [BlockOperation] = []
var fetchedResultController: NSFetchedResultsController<Entity> {
if _fetchedResultsController != nil {
return _fetchedResultsController!
}
let fetchRequest: NSFetchRequest<Entity> = Entity.fetchRequest()
let managedObjectContext = (UIApplication.shared.delegate as! AppDelegate).managedObjectContext!
@danielmcclure
danielmcclure / remove-cpt-feed-titles.php
Created July 21, 2017 03:56
Remove Title from Custom Post Type Feeds
<?php
// Remove Title from 'Status' Custom Post Type Feed
function remove_post_title_rss($title) {
global $post;
$post_type = get_post_type($post->ID);
if ($post_type == 'status') {
$title = '';
}
return $title;
@pedantix
pedantix / JWTService.swift
Last active April 14, 2018 02:12
# Snippets For how I hacked together
import Foundation
import JWT
import Vapor
final class JWTService: Service {
var signer: JWTSigner
init(secret: String) {
signer = JWTSigner.hs512(key: Data(secret.utf8))
}
@atomicbird
atomicbird / wwdc2019-online-sessions.md
Last active May 29, 2020 22:59
WWDC 2019 Online-only Sessions

At WWDC 2019 Apple released some videos directly online, with no corresponding live session. This is a list of those videos with links to the video pages.

Some sessions were presented during WWDC but then split into multiple videos when posted online. This list includes the online versions, since they don't appear in the WWDC schedule. For example WWDC included session 711, "Introducing Combine and Advances in Foundation". This was split into two online videos-- 722, "Introducing Combine", and 723, "Advances in Foundation". Both 722 and 723 are included here.

@AvdLee
AvdLee / FileManagerExtensions.swift
Last active November 19, 2023 23:23
Easily print out useful locations for usage during debugging on the Simulator.
extension FileManager {
/*
Prints out the locations of the simulator and the shared group folder.
This is useful for debugging file issues.
Example usage: FileManager.default.printFileLocations()
*/
func printFileLocations() {
let paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)
let simulatorFolder = paths.last!
@swiftui-lab
swiftui-lab / SwiftUI-view-to-UIImage.swift
Created July 5, 2020 19:43
A method for converting a SwiftUI into a UIImage
//
// ContentView.swift
// Grabber
//
// SwiftUI-Lab
//
// For more information on the techniques used in this example, check
// The Power of the Hosting+Representable Combo (https://swiftui-lab.com/a-powerful-combo/)
import SwiftUI