Skip to content

Instantly share code, notes, and snippets.

@Phally
Phally / DAG_MySQL.sql
Last active August 29, 2015 14:25 — forked from xib/DAG_MySQL.sql
Direct Acyclic Directed Graph in MySQL database
-- Based on the original articel at http://www.codeproject.com/Articles/22824/A-Model-to-Represent-Directed-Acyclic-Graphs-DAG-o
-- Here is a port to MySQL
-- Edge table
DROP TABLE IF EXISTS `Edge`;
CREATE TABLE IF NOT EXISTS `Edge` (
`id` int(11) NOT NULL,
`entry_edge_id` int(11) DEFAULT NULL COMMENT 'The ID of the incoming edge to the start vertex that is the creation reason for this implied edge; direct edges contain the same value as the Id column',
`direct_edge_id` int(11) DEFAULT NULL COMMENT 'The ID of the direct edge that caused the creation of this implied edge; direct edges contain the same value as the Id column',
`exit_edge_id` int(11) DEFAULT NULL COMMENT 'The ID of the outgoing edge from the end vertex that is the creation reason for this implied edge; direct edges contain the same value as the Id column',

Keybase proof

I hereby claim:

  • I am Phally on github.
  • I am phally (https://keybase.io/phally) on keybase.
  • I have a public key whose fingerprint is 209B E3C7 28CE 1F3F A3ED 2791 543F 74DE C933 F63A

To claim this, I am signing this object:

@Phally
Phally / gist:2dda57f409e05533a0aa
Last active August 29, 2015 14:04
Apache configuration needed
#
# Currently we have a webshop running that is forced to SSL using
# 301 redirects. There are no exceptions, everything goes through
# SSL.
#
# What we need is a vhost setup (not .htaccess) that allows images
# (/img/*) to be called with and without SSL. So without the
# redirects. Everything else MUST be redirected to HTTPS.
#
# Please note that it MUST always redirect to the www subdomain.
<?php
// Get solar minutes for seconds.
function solar($seconds) {
$leap = 365.25 / 365;
$inSeconds = $seconds * $leap;
$inMinutes = $inSeconds / 60;
return round($inMinutes);
}
@Phally
Phally / bootstrap.php
Last active December 11, 2015 03:49
This gist describes briefly how to setup a virtual host for nginx that will be a project as a sub folder. Please note that you need a virtual host like this one for every project you have.
<?php
// In APP/Config/bootstrap.php add the following code:
if (($baseUrl = Configure::read('App.baseUrl')) !== false) {
Configure::write('App.base', $baseUrl);
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"