Skip to content

Instantly share code, notes, and snippets.

View JosephNC's full-sized avatar
🎯
Focusing

Chukwudiebube Joseph Nwakpaka JosephNC

🎯
Focusing
View GitHub Profile
@JosephNC
JosephNC / .env
Created May 15, 2023 20:43 — forked from torshid/.env
https://larawind.com/shared-laravel-sessions-across-domains Shared Laravel sessions across domains
PORTAL_DOMAIN=localhost
SESSION_DRIVER=shared
const backToCollections = document.querySelector(".back-to-collections");
console.log(backToCollections);
const listParentCollections = () => {
backToCollections.style.display = "none";
document.querySelectorAll(".collection-grid-item").forEach((elm) => {
let aTag = elm.querySelector("a");
let parentId = elm.dataset.parent;
From terminal:
1: yum install epel*
2: yum update / yum upgrade
3: Add repo source
- CentOS and Red Hat Enterprise Linux 6.x
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm
@JosephNC
JosephNC / pe-customize-controls.css
Created August 2, 2018 22:51 — forked from OriginalEXE/pe-customize-controls.css
Extending WordPress Customizer Panels and Sections to allow nesting
.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel-parent,
#customize-theme-controls .customize-pane-child.current-section-parent {
-webkit-transform: translateX(-100%);
-ms-transform: translateX(-100%);
transform: translateX(-100%);
}
@JosephNC
JosephNC / base64-png.php
Last active April 25, 2018 20:47
Function to save base64 image to png in PHP
<?php
function base64_png($data, $filename) {
$img = str_replace('data:image/png;base64,', '', $data);
$img = str_replace(' ', '+', $img);
$data = base64_decode($img);
return file_put_contents($filename, $data);
}
$filename = __DIR__ . '/' . uniqid() . '.png';
@JosephNC
JosephNC / wordpress-rewrite-rules.php
Created April 24, 2018 00:21 — forked from jeremyboggs/wordpress-rewrite-rules.php
Some methods I generally use to create my own rewrite rules for WordPress. Taken from WordHub project.
<?php
/**
* Some basics for creating your own rewrite rules in WordPress. Taken from
* my WordHub plugin.
*/
class Whatever {
function init() {
add_action( 'rewrite_rules_array', array( $this, 'rewrite_rules_array') );
add_filter( 'query_vars', array( $this, 'query_vars' ) );
@JosephNC
JosephNC / number_format.js
Created February 16, 2018 04:55
JavaScript equivalent for PHP number format.
/**
* Format a number with grouped thousands
*
* @param number The number being formatted
* @param decimals Sets the number of decimal points
* @param dec_point Sets the separator for the decimal point
* @param thousands_sep Sets the thousands separator
* @returns string A formatted version of number
*/
function number_format( number, decimals, dec_point, thousands_sep ) {