Skip to content

Instantly share code, notes, and snippets.

View cebe's full-sized avatar
☁️
working on cebe.cloud

Carsten Brandt cebe

☁️
working on cebe.cloud
View GitHub Profile
@auroraeosrose
auroraeosrose / gist:d038ec0f9fc82985fe06
Created February 26, 2015 16:36
Go PHP7(ext) - What we're doing

A quick snapshot of what is going on with the project - for the tl;dr see "what can I do?"

What is complete

  1. A name- GoPHP7 is a project (not yet really started) to motivate people to migrate to PHP7 when it's released. This echoes the GoPHP5 project of the past
  2. An irc channel - registered on freenode - owner auroraeosrose, ops lornajane, ircmaxell and joepferguson
  3. A set of goals - see http://goo.gl/BJ3s8D

What is in process

  1. Getting "adminy" stuff set up (lornajane is in charge) - This will include website, wikis, twitter, whatever, and other tools
@ShNURoK42
ShNURoK42 / MyParsedown
Last active February 6, 2023 20:18
Mention for Parsedown
<?php
class MyParsedown extends \Parsedown
{
function __construct()
{
$this->InlineTypes['@'][]= 'UserMention';
$this->inlineMarkerList .= '@';
}
@greydnls
greydnls / default.php
Created June 18, 2015 16:14
Default Object
public function amazingFunction(CoolObjectInterface $object = new SlightlyColdObject())
{
$this->object = $object;
}
public function notAsAmazingFunction(BlahObjectInterface $object = null)
{
if ($object == null) $this->object = new BoringObject();
}
@tom--
tom-- / 3-way-joins.md
Last active October 20, 2020 09:42
Using 3-way join tables in Yii 2 Active Record

I have an interesting Yii 2 AR design problem.

The DB has 12 primary entity tables related via a full mesh of 72 join tables. Each relation also has a type (and attributes) but those aren't stored in the join tables – they are in additional tables that the 72 join tables reference. So each of the 72 join tables provides a 3-way join between one entity, another entity and another table called link that points to the link_type.

My problem is to write the AR models and relation methods.

Let's make this more concrete with two of the primary entities: artist and recording, related through l_artist_recording. Each record of l_artist_recording has an FK to the link table, through which I can load the link_type name. For example, an artist-recording relation might have link_type "performer", "conductor", or "producer" etc.

This is a simplified schma good enough for thinking about the AR p

__ __ _ ___ _ _
\ \ / /_ _| |__ / __| |_ __ ___ _(_)_ _ __ _
\ V / _` | / / \__ \ ' \/ _` \ V / | ' \/ _` |
|_|\__,_|_\_\ |___/_||_\__,_|\_/|_|_||_\__, |
|___/ YAK SHAVING LTD
═══════════════
Company Number: 09522289
73 Douglas Buildings
Marshalsea Road
@tom--
tom-- / generateRandomKeyReqs.php
Created January 4, 2016 16:28
Detailed requirements checks for Yii 2.0.7's yii\base\Security::generateRandomKey()
<?php
$tests = [
"function_exists('random_bytes')",
"defined('OPENSSL_VERSION_TEXT') ? OPENSSL_VERSION_TEXT : null",
"PHP_VERSION_ID",
"function_exists('mcrypt_create_iv') ? bin2hex(mcrypt_create_iv(8, MCRYPT_DEV_URANDOM)) : null",
"DIRECTORY_SEPARATOR",
"sprintf('%o', lstat('/dev/urandom')['mode'])",
"sprintf('%o', lstat('/dev/urandom')['mode'] & 0170000)",
@tom--
tom-- / Random bytes, ints, UUIDs in PHP.md
Last active July 10, 2025 16:41
PHP random bytes, integers and UUIDs

Random bytes, ints, UUIDs in PHP

Simple and safe random getters to copy-paste

string randomBytes( int $length )

int randomInt ( int $min , int $max )

string randomUuid ( void )
@cebe
cebe / .gitignore
Last active April 21, 2022 14:34
CGAL fails to read OFF file generated by Minkowsky Sum https://github.com/CGAL/cgal/issues/978
/bug
/*.o
@SkyzohKey
SkyzohKey / konv-ux-whitepaper.md
Last active April 17, 2017 21:01
Konv UX Whitepaper

Konv UX whitepaper

1. Summary

Konv aims to be a modern, easy-to-use and secure Instant Messaging Skype replacement. It should provides a cool UI/UX to end-users, with a « Power user » mode to allow more skilled guys to enjoy it too.

Konv should be finely designed and simple to understand with the first time, even a grandma should be able to use it without troubles.

Konv should provides at least features others IM apps (Skype, Whatsapp, Messenger, etc) has plus extra features that'll make it unique.

2. Targeted users

@tom--
tom-- / README.md
Last active October 14, 2017 19:47
Controling a group of daemons and timer jobs with a systemd target

Controling a group of daemons and timer jobs with a systemd target

Scenario

The custom web application My App, in addition to its web server request-driven work, has three daemons (able, baker and charlie) and three jobs (dog, easy and fox) that run (cron-like) on a pre-defined schedule.

Requirements