Skip to content

Instantly share code, notes, and snippets.

View cosmomathieu's full-sized avatar
🎯
Focusing

Cosmo Mathieu cosmomathieu

🎯
Focusing
View GitHub Profile
@cosmomathieu
cosmomathieu / update-mysql.md
Created February 20, 2018 16:10
Upgrade MySQL 5.5 to 5.7 Ubuntu 16

Upgrade MySQL 5.5 to 5.7 Ubuntu 16

First of all , Backup All your Database.

mysqldump --all-databases > all_databases.sql

Grab the library which contains the 5.7 verson

wget https://dev.mysql.com/get/mysql-apt-config_0.8.9-1_all.deb
@cosmomathieu
cosmomathieu / jquery.background-image-scroll-effects.js
Last active April 8, 2023 03:08
A lightweight jQuery plugin to animate background images on scroll; fade, zoom, and blur.
/**
* jQuery plugin for adding hero image background animation
*
* Zooms, blurs, and fades background image on scroll down.
*
* @author Cosmo Mathieu <cosmo@cosmointeractive.co>
*/
// jquery-ps-background-animate.js
/*!
<?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();
@cosmomathieu
cosmomathieu / FileManager.php
Last active April 8, 2023 02:58
Using FlySystem with Digital Oceans Spaces
<?php
class FileManager
{
const USER_FOLDER = siteData()->userFolder;
protected $adapter;
public function __construct($adapter)
{
@cosmomathieu
cosmomathieu / README.md
Last active September 2, 2021 13:42
A collection of helpful bash commands

Bash Scripts and Commands

A collection of helpful bash scripts.

List

File Name Description
mkdirandmove.sh Creates a new folder in the current directory and then moves everything into that folder
@cosmomathieu
cosmomathieu / JsonResponse.php
Last active April 24, 2021 16:39
A PHP json object template for dealing with php and ajax form submissions
<?php
/**
* A PHP json object template for dealing with php and ajax form submissions
*
* Provides a framework (for lack of better words) for dealing with ajax
* form submissions. Provides an example of how the php and JavaScript code
* should be formatted.
*
* @author Cosmo Mathieu <cosmo@cosmointeractive.co>
*/
@cosmomathieu
cosmomathieu / README.md
Last active June 5, 2020 01:23
Creating GitHub packages

Publishing to GitHub Packages

Login

npm login --registry=https://npm.pkg.github.com --scope=@pagestudiocms

Username: 
Password: <gitHub access token>
Email (optional):
@cosmomathieu
cosmomathieu / css.php
Last active May 28, 2020 15:41
Adding styles directly into the page template from the controller
<?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)',
@cosmomathieu
cosmomathieu / upgrade-php.sh
Last active March 11, 2020 13:26
Upgrading PHP 5.5.9 to 5.6
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php5.6 php5.6-bcmath php5.6-bz2 php5.6-dba php5.6-imagick php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-soap php5.6-xml php5.6-zip
sudo a2dismod php5
sudo a2enmod php5.6
sudo service apache2 restart
@cosmomathieu
cosmomathieu / README.md
Last active March 11, 2020 13:24
VirtualHost site creation script

VirtualHost site creation script

Create a VirtualHost via PHP CLI script

Usage

# sudo ./sitegen/cli ${siteName} ${webRoot}
sudo ./sitegen/cli mywebsitename.local /var/www