Skip to content

Instantly share code, notes, and snippets.

@perico
perico / index.php
Created January 4, 2018 15:53
Enable CORS in php hack
//Add this to your index.php
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: POST, PATCH, GET, OPTIONS, DELETE, PUT, HEAD");
header("Access-Control-Max-Age: 1728000");
header("Access-Control-Allow-Headers: Content-Type, origin, authorization, accept");
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS')
exit;
@perico
perico / cpm.js
Last active January 31, 2023 05:50
Critical Path Method Implementation Javascript
/**
* Implementation of the Critical Path Method (CPM) with variation
* @see http://en.wikipedia.org/wiki/Critical_path_method
*
* Shows all the critical Paths, returns a subset of the graph
* containing the critical activities
*/
/**
* Activity Class