Skip to content

Instantly share code, notes, and snippets.

View liambolling's full-sized avatar
🏠
Working from home

Liam Bolling liambolling

🏠
Working from home
View GitHub Profile
<script defer src="/__/firebase/8.3.1/firebase-firestore.js"></script>
<script defer src="/__/firebase/8.3.1/firebase-functions.js"></script>
import Foundation
import UIKit
var iconDictonary: [[String:Any]] = [
[
"icon":"food",
"tags":["food", "dinner","breakfast","lunch","brunch","meal","feed"]
],
[
"icon":"airport",
@liambolling
liambolling / extensions.swift
Created September 2, 2019 21:19
Find blank or white spaces in a string (Swift 4)(Extension)
extension String {
var isBlank: Bool {
get {
let trimmed = self.trimmingCharacters(in: NSCharacterSet.whitespaces)
return trimmed.isEmpty
}
}
}
@liambolling
liambolling / crop_multiple_sizes_image.js
Created August 2, 2015 23:48
Crop and Resize Multiple Sizes in Parse Cloud Code
Parse.Cloud.define("crop_multiple_sizes_image.js", function(request, response) {
var url = request.params.imageURL;
var returnImagesArray = [];
// Requires two packages to make this happen.
var _ = require('underscore.js');
var Image = require("parse-image");
// Default images sizes.
var image_card_2x = [540, 350];
@liambolling
liambolling / remove_fluff_phone_numbers.js
Created June 25, 2014 00:32
A function to sort out letters, symbols, and anything beside numbers from phone numbers. Removes everything, but numbers from phone numbers. Used for numbers that are already entered in a database/array that need cleaning.
function cleanPhoneNumber(phoneString){
//Use .match and regex to cut out the crap from the phone number
match = phoneString.match(/\D*\(?(\d{3})?\)?\D*(\d{3})\D*(\d{4})\D*(\d{1,8})?/);
//Assuming there are 3 parts... you can add more checks for arrays if you run into the issue of extensions.
if(match[3] === 'undefined'){
if(match[2] === 'undefined'){
if(match[1] === 'undefined'){
@liambolling
liambolling / iu_cas_login
Created June 7, 2014 17:19
Connecting to Indiana University via CAS Login
//Note: I did not write all of this code. Some was provided by IU. I am only showing an efficient method to
//making sure they are an IU student. I wrote this code for use on the iuifc.org website. Any problems? @liambolling
//You may not need this. I found it helped to make sure to ask for auth.
session_start();
//This will send the user everytime to CAS to authenticate.
//Fixes the whole "I closed my browser but not out of CAS" thing.
@liambolling
liambolling / example_recent_events
Last active August 29, 2015 14:02
Example - Pull recent events from iuifc.org
//This is the exact code that we use to display recent events on our homepage and through out the website.
//Import the file
$file = 'https://iuifc.org/wp-content/themes/iuifc/json-data/public_calendar_5_recent.json';
//This url will just show all events in order they were created.
//https://iuifc.org/wp-content/themes/iuifc/json-data/public_calendar_data.json
//Decode them into something we can work with
$json_array = json_decode(file_get_contents($file), true);