npm login --registry=https://npm.pkg.github.com --scope=@pagestudiocms
Username:
Password: <gitHub access token>
Email (optional):
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// An example of how to generate inpage css for body | |
// Typically saved in a database OR in theme folder as style.custom.css | |
$encodedStyles = json_encode([ | |
'body' => [ | |
'font-family' => '"NeutraText-Book"', | |
'font-size' => '14px', | |
'background-color' => 'rgba(255, 255, 255, 1)', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### Set Language | |
TEXTDOMAIN=virtualhost | |
### Set default parameters | |
action=$1 | |
domain=$2 | |
rootDir=$3 | |
owner=$(who am i | awk '{print $1}') | |
apacheUser=$(ps -ef | egrep '(httpd|apache2|apache)' | grep -v root | head -n1 | awk '{print $1}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class FileManager | |
{ | |
const USER_FOLDER = siteData()->userFolder; | |
protected $adapter; | |
public function __construct($adapter) | |
{ |
Build Unordered List Dynamically via JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @see https://jsfiddle.net/cosmointeractive/ukb8Lpm1/ | |
*/ | |
const events = (function() { | |
'use strict' | |
var _triggers = {}; | |
const on = function(event, callback) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Return the current server date and time to the caller | |
* | |
* @param $format Date format | |
* @return datetime Formated date and time | |
*/ | |
if( ! function_exists('datetime')){ | |
function datetime($format = 'Y-m-d H:i:s') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$file = $file['temp']['file']; | |
$image = new Image($file); | |
$image->save(${filename}, [optional]${quality}); // Use this when moving a file from one location to another. Especially in the case when we upload a file to the server. | |
$image->resize(${width}, ${height}, [optional]${crop}, [optional]${replace}); | |
$image->createThumb(${width}, ${height}, [optional] ${save_path}); | |
$image->getWidth(); | |
$image->getHeight(); |
NewerOlder