Skip to content

Instantly share code, notes, and snippets.

View kirasiris's full-sized avatar
😍
In love with JavaScript!!

Kevin Uriel Fonseca kirasiris

😍
In love with JavaScript!!
View GitHub Profile
// per https://docs.npmjs.com/misc/scripts, npm exposes a bunch of variables to
// the environment prefixed with npm_config_*, npm_package_* and npm_lifecycle_*.
// Here's a list of all variables exposed in my setup.
npm_config_access=
npm_config_allow_same_version=
npm_config_also=
npm_config_always_auth=
npm_config_argv='{"remain":[],"cooked":["run","foo"],"original":["run","foo"]}'
npm_config_auth_type=legacy
@kirasiris
kirasiris / controller.php
Created April 27, 2018 10:08 — forked from Jakeii/controller.php
Get categories and subcategories in one query, seen many solutions that get the categories and for each category check for subcategories. Uses codeigniter framework, fairly easy to convert to vanilla php if you need. Probably a better storage/display solution than the strange array that I used.
<?php
$cats_result = $this->model->get_categories($swapid);
if ($cats_result->num_rows() > 0) {
$cat_index = $sub_index = $row_index = 0;
do {
$cats[$cat_index]['cat'] = array(
'name' => $cats_result->row($row_index)->cat_name,
'title' => $cats_result->row($row_index)->cat_title
);