Skip to content

Instantly share code, notes, and snippets.

View iolloyd's full-sized avatar
💭
Busy bee

Lloyd Moore iolloyd

💭
Busy bee
View GitHub Profile

Keybase proof

I hereby claim:

  • I am iolloyd on github.
  • I am iolloyd (https://keybase.io/iolloyd) on keybase.
  • I have a public key ASAhk9_vHHaUrMBwWgJ0cCeGoAjI9rRsrxjox-DZD-wD7wo

To claim this, I am signing this object:

@iolloyd
iolloyd / Reality.txt
Created January 7, 2017 17:05
Some thoughts on reality
Change your reality from within
What is reality? I mean, what does it mean when we mention reality? Is reality something that is unique to each and every one of us because of our own conceptions? Think about that for a minute. When something is defined as real or not real, it would be more correct to say that it exists or does not, because everything that does exist is real. The thought of something that we do not know to exist is real itself and yet the subject of the thought may not be so.
But it is certainly true that if something does exist, then it can be proven, but if we do not know that something exists, we cannot prove that fact because we can only say that something does not exist to the best of our own knowledge.
So given those facts, reality is different to each being that has some state of awareness. Based on our own conceptions, we experience our own version of what is real to our senses and our thoughts. But why do we not, as individuals, share the same reality? I mean, we share similar exp
@iolloyd
iolloyd / training-notation.md
Created December 13, 2016 08:24
A system of taking notes when training with weights

This is my system for noting my workouts.

SQ 100k10,110k8,120k6,3/3m

The exercise is Squats, using the abbreviation, SQ.

Then follows a set of 100kgs for 10 reps, 110kgs for 8 reps, 120kgs for 6 reps, and finally a set at the same weight of 120kgs for 3 reps. Finally, /3m indicates that there was a 3 minute gap between all of those sets.

SQ 100k10/2

@iolloyd
iolloyd / cherrypick_vs_rebase.md
Last active December 9, 2016 19:18
Difference between cherrypick and rebase
   A---B---C---D master
  /
E---F---G---H feature

git rebase master feature

E---F---G---H feature

\

@iolloyd
iolloyd / branch_fix.sh
Created December 9, 2016 10:37
Branching from the wrong branch in git
# branch/current <- Branch with commits
# branch/main <- Branch that should have been branched from
# branch/other <- Branch that was actually branched from
git checkout branch/main
git checkout -b branch/correct
git rebase --onto branch/correct branch/other branch/current
@iolloyd
iolloyd / insert_with_parent_id.sql
Created December 6, 2016 04:25
Inserting multiple rows that are related to a parent table using postgresql functions
-- Schema (redacted)
CREATE TABLE set
(
workout_id INTEGER,
kgs NUMERIC NOT NULL,
reps INTEGER NOT NULL,
placement INTEGER NOT NULL,
exercise_id INTEGER,
CONSTRAINT set_workout_id_fkey FOREIGN KEY (workout_id) REFERENCES workout (id),
CONSTRAINT set_exercise_id_fkey FOREIGN KEY (exercise_id) REFERENCES exercise (id)
@iolloyd
iolloyd / naughty.js
Created August 17, 2016 14:58
Object.keys sometimes no no
- const activePublicStylistIds = Object.keys(store.publicStylists).filter(id => store.publicStylists[id].isActive)
+ let activePublicStylistIds = []
+ if ('publicStylists' in Object.keys(store)) {
+ activePublicStylistIds = Object.keys(store.publicStylists).filter(id => store.publicStylists[id].isActive)
+ } else {
+ activePublicStylistIds = []
+ }
@iolloyd
iolloyd / dtrace-netsuite-post.sh
Created August 14, 2016 20:11
dtrace of POST /notify/netsuite
CPU ID FUNCTION:NAME
0 946 open_nocancel:entry .
0 160 open:entry /Users/lloyd/projects/lbapi/public/index.php
0 160 open:entry /Users/lloyd/projects/lbapi/vendor/autoload.php
0 160 open:entry /Users/lloyd/projects/lbapi/vendor/composer/autoload_real.php
0 160 open:entry /Users/lloyd/projects/lbapi/vendor/composer/ClassLoader.php
0 160 open:entry /Users/lloyd/projects/lbapi/vendor/composer/include_paths.php
0 160 open:entry /Users/lloyd/projects/lbapi/vendor/composer/autoload_namespaces.php
0 160 open:entry /Users/lloyd/projects/lbapi/vendor/composer/autoload_psr4.php
0 160 open:entry /Users/lloyd/projects/lbapi/vendor/composer/autoload_classmap.php
@iolloyd
iolloyd / slim-file-usage.sh
Created August 13, 2016 10:44
Files used by slim when a request is made
CPU ID FUNCTION:NAME
0 946 open_nocancel:entry .
0 160 open:entry /Users/lloyd/projects/lbapi/public/index.php
0 160 open:entry /Users/lloyd/projects/lbapi/vendor/autoload.php
0 160 open:entry /Users/lloyd/projects/lbapi/vendor/composer/autoload_real.php
0 160 open:entry /Users/lloyd/projects/lbapi/vendor/composer/ClassLoader.php
0 160 open:entry /Users/lloyd/projects/lbapi/vendor/composer/include_paths.php
0 160 open:entry /Users/lloyd/projects/lbapi/vendor/composer/autoload_namespaces.php
0 160 open:entry /Users/lloyd/projects/lbapi/vendor/composer/autoload_psr4.php
0 160 open:entry /Users/lloyd/projects/lbapi/vendor/composer/autoload_classmap.php
@iolloyd
iolloyd / slim.php
Created August 8, 2016 15:10
How slim v3 makes the app available in the callback
public function add(\Slim\Middleware $newMiddleware)
{
if(in_array($newMiddleware, $this->middleware)) {
$middleware_class = get_class($newMiddleware);
throw new \RuntimeException("Circular Middleware setup detected. Tried to queue the same Middleware instance ({$middleware_class}) twice.");
}
$newMiddleware->setApplication($this);
$newMiddleware->setNextMiddleware($this->middleware[0]);
array_unshift($this->middleware, $newMiddleware);
}