How to Chunk Large Files in Swift
How to Chunk Large Files in Swift (4.1)
It takes a bit of work but this is the solution I found that finally worked, thanks to this Stack Overflow thread https://stackoverflow.com/questions/46464177/split-data-in-chunks-and-upload-to-server
The example ...
Written by Sean Behan on 09/15/2018
How to Recover a Mistakenly Deleted Branch
Workflow
git checkout -b _new_branch_name
# do some work and commit changed
git checkout master
git branch -d _new_branch_name
# doh... i meant to merge first
Fortunately, you can easily recover from this mistake.
git reflog
395b1ea HEAD@{0}: checkout...
Written by Sean Behan on 06/17/2012
How to Use Named Variables with Postgres and PHP PDO Driver
You can write reusable scripts with Postgres by taking advantage of named variables.
A named variable starts with a `:` in your sql script. Here is an example
select :a_number
You can then use this statement with `psql` and the `--variable` fl...
Written by Sean Behan on 11/11/2017
How to Get a Random Item from an Array in PHP
Use this snippet for grabbing a random item from an array in php
$fruits = ['apple', 'banana', 'carrot', 'date', 'elderberry'];
echo array_rand(array_flip($fruits));
// => 'banana'
PHP's `array_flip` makes the keys the values and the valu...
Written by Sean Behan on 11/10/2017
Why Doesn't Google Offer Dedicated Virtual Hosting?
AppEngine is nice, but it's a little limiting. No cron jobs, filesystem use nor customization with third party libraries, software, databases, languages, etc. You can't deploy PHP, Ruby and or your 'other' favorite web development tools.
You can only use ...
Written by Sean Behan on 06/17/2012