Skip to content

Instantly share code, notes, and snippets.

View cbrewster's full-sized avatar

Connor Brewster cbrewster

View GitHub Profile
@cbrewster
cbrewster / MergeSort.swift
Created September 8, 2015 21:14
Merge Sort (Swift)
import Cocoa
var array = [Int](count: 10, repeatedValue: 0)
for var i = 0; i < array.count; i++ {
array[i] = random() % 100
}
func merge(inout array: [Int], p: Int, q: Int, r: Int) {
let len1 = q - p + 1
let len2 = r - q
@cbrewster
cbrewster / AlterPermissionIssue.md
Last active September 3, 2015 21:25
Alter Permission Issue

It looks like the following condition is causing the issue:

!array_key_exists('allow_alter', $attributes)

I feel like this condition should probably still be in place, but some reason the key exists before this point during table creation, which I assume is unintended.

private function verifyPrivilege($attributes) {
    debug_print_backtrace();
    // Making sure alter is set for admin only.
 if($this-&gt;isCurrentUserAdmin() &amp;&amp; !array_key_exists('allow_alter', $attributes)) {