Skip to content

Instantly share code, notes, and snippets.

@cyphercodes
cyphercodes / LetsEncrypt&Express.md
Last active September 5, 2018 17:02
Let's Encrypt Certificat & Express with Auto Renewal on Ubuntu 18.04
sudo apt install letsencrypt
const express = require('express'),
    app = express();
    
app.use(express.static(path.join(__dirname, 'static')));
app.get('/', (req, res) => res.send("I'm ALIVE!"));
@cyphercodes
cyphercodes / example
Last active September 28, 2015 23:06
CODE:
Branch::find()
->where(['id' => $id])
->with(['branchcategories' => function($q) {
$q->select(['id', 'name', 'branch_id', '(select COUNT(*) from branchitem where branchcategory_id=branchcategory.id AND status = ' . Branchitem::STATUS_ACTIVE . ') AS thecount'])->where(['status' => Branchcategory::STATUS_ACTIVE])->having('thecount > 0');
}])->with(['branchcategories.branchitems' => function($q) {
$q->select(['id', 'name', 'description', 'price', 'branchcategory_id'])->where(['status' => Branchitem::STATUS_ACTIVE]);
}])
->with(['branchcategories.branchitems.branchitempictures' => function($q) {
$q->select(['id', 'src_thumb', 'restoitem_id'])->orderBy("id desc")->limit(1);