Skip to content

Instantly share code, notes, and snippets.

Focusing, always!

Paul Peelen ppeelen

Focusing, always!
View GitHub Profile
ppeelen / dabblet.css
Created Dec 17, 2011
The first commented line is your dabblet’s title
View dabblet.css
* The first commented line is your dabblet’s title
background: #f06;
background: linear-gradient(45deg, #f06, brown);
View NSDate extension
extension NSDate {
func isGreaterThanDate(dateToCompare : NSDate) -> Bool {
return == NSComparisonResult.OrderedDescending
func isLessThanDate(dateToCompare : NSDate) -> Bool {
return == NSComparisonResult.OrderedAscending
ppeelen / How to install a basic Apache, PHP and MySQL development environment with Homebrew. Mirrored from the Echo & Co. blog.

How to install a basic Apache, PHP and MySQL development environment with Homebrew

This guide will walk you through the steps required to install a basic Apache, PHP and MySQL development environment using homebrew. Basically, all you'll need to do is copy the commands below into Terminal. Copy one block at a time.

NOTE: this guide is mirrored from Echo & Co.'s blog in case the original blog post or the website decides to go down. I've shared this guide around many times to colleagues and friends. Please give Alan Ivey (@alanthing) all of the credit for publishing this really helpful guide.

Before we begin...

We're going to need to install homebrew, a super awesome package manager for OS X. Installation instructions are available on the homebrew website.

ppeelen / .bash_profile
Last active Aug 27, 2018
My bash profile
View .bash_profile
# Update the path with other important bin folders
export PATH=$(echo $PATH | sed 's|/usr/local/bin||; s|/usr/local/sbin||; s|::|:|; s|^:||; s|\(.*\)|/usr/local/bin:/usr/local/sbin:\1|')
# Adding Bash Completion
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
# Show a different color on master & develop branch
View GoogleTagManager
"6.0.0": ""
ppeelen / LazyFilter.swift
Last active Jun 9, 2021
Swift: Lazy filter with prefix. Check if occurrence of X happens more than Y times using filter
View LazyFilter.swift
struct FooBar {
let state: Bool
func isTrue() -> Bool { state } // Called 1000 times
func isFalse() -> Bool { !state } // Called 92 times
let fooList = (0..<1000).compactMap { n in FooBar(state: Bool.random()) }
let start = CFAbsoluteTimeGetCurrent()
if fooList.filter({ $0.isTrue() }).count > 1 {
ppeelen / RawRepresentableVsVar.swift
Last active Jun 14, 2021
An example on why not to try to reinvent the wheel, use the power of Swift.
View RawRepresentableVsVar.swift
import Foundation
enum FooBar: String, CaseIterable {
case Foo
case Bar
enum BarFoo: CaseIterable {
case Bar
case Foo
ppeelen / ArrayPartition.swift
Created Aug 19, 2021
This extension will partition an array into an array with sub items depending on the parent item. It is mean to de-flatten a flattened array.
View ArrayPartition.swift
import Foundation
// The definition of our struct
struct FooBar: Equatable{
enum ItemType {
case main, sub
let itemType: ItemType
let name: String
View DictionaryComparison.swift
import Foundation
let dictOne: [String: String] = [
"key1": "value one",
"key2": "value two",
"key3": "value three",
"key4": "value four"
let dictTwo: [String: String] = [
ppeelen /
Last active May 31, 2022
Generating CodeCov JSON report from CLI
# Run tests with enableCodeCov YES, e.g. fastlane scan with code_coverage: true
# In your derived_data folder, run the following:
xcrun xcresulttool merge Logs/Test/*.xcresult --output-path bundle.xcresult # Combines all the XCResult files
xcrun xccov view --report --json bundle.xcresult > CodeCov-report.json # Generates the report into a JSON file