Skip to content

Instantly share code, notes, and snippets.

View kapolos's full-sized avatar

John Kapolos kapolos

View GitHub Profile
@kapolos
kapolos / resolution.md
Created October 22, 2018 15:46
Notes on the logic of url resolution.

Overview

Given //site/variable, what are the steps to resolve the template & content. The priority is from higher to lower. Once a match is found, the chain breaks.

Logic

  1. Check if variable is a hardcoded url (like the footer links, about page, login page etc.)
  2. Decompose variable into its parts (e.g. ["inner-circle", "special-reports"])
  3. Check if the first part belongs to a subscription (e.g. inner-circle).If it's part of a subscription, use the rules for it (next segment).
@kapolos
kapolos / resolution.md
Last active October 22, 2018 15:43
Notes on the logic of url resolution.

Overview

Given //site/variable, what are the steps to resolve the template & content. The priority is from higher to lower. Once a match is found, the chain breaks.

Logic

  1. Check if variable is a hardcoded url (like the footer links, about page, login page etc.)
  2. Decompose variable into its parts (e.g. ["inner-circle", "special-reports"])
  3. Check if the first part belongs to a subscription (e.g. inner-circle).If it's part of a subscription, use the rules for it (next segment).

Keybase proof

I hereby claim:

  • I am kapolos on github.
  • I am kapolos (https://keybase.io/kapolos) on keybase.
  • I have a public key ASBE3YtHhBg3zvxX8kBZmaB84DreRxEop7nGC01VSL1miAo

To claim this, I am signing this object:

<?php
class SingleLinkedListNode
{
public $value, $next;
public function __construct($value = NULL)
{
$this->value = $value;
}
<?php
/**
* Returns an array with each position filled with the product of all
* elements of the original array except for the one on the respective position
*
* @param array $arr
*
* @return array
*/
/**
* Checks if the sum of any 2 values of the array equals to $sum
* Assumes a non-associative array with numeric values
*
* @param array $arr
* @param integer $sum
*
* @return bool
*/
function checkSumExists(array $arr, $sum)
/**
* Recursively flattens an array
*
* @param array $arr
*
* @return array
*/
function flatten(array $arr)
{
$recursiveIterator = new RecursiveArrayIterator($arr);