Skip to content

Instantly share code, notes, and snippets.

Lawrence Cherone lcherone

Block or report user

Report or block lcherone

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lcherone
lcherone / gh-pages-deploy.md
Created Apr 25, 2018 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).
View gh-pages-deploy.md

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@lcherone
lcherone / README.md
Last active Apr 9, 2018 — forked from remarkablemark/README.md
Classes - ES5 vs ES6
View README.md

JavaScript Classes - ES5 vs ES6

An example that shows the difference between creating a JavaScript class and subclass in ES5 and ES6.

@lcherone
lcherone / wait.sh
Last active Apr 6, 2018
Linux wait for network connection before continuing. Docker, LXC, containers, cloud-init
View wait.sh
#/bin/bash
echo "Waiting for network connection."
while [ 1 ]; do
if ping -q -c 1 -W 1 8.8.8.8 > /dev/null 2>&1; then
break;
fi
sleep 1
done
@lcherone
lcherone / hash_file_multi.php
Created Mar 26, 2018
hash_file_multi() hash a single file with multiple algorithms PHP
View hash_file_multi.php
<?php
function hash_file_multi($algos = [], $filename) {
if (!is_array($algos)) {
throw new \InvalidArgumentException('First argument must be an array');
}
if (!is_string($filename)) {
throw new \InvalidArgumentException('Second argument must be a string');
}
@lcherone
lcherone / WordPress.sh
Last active Apr 6, 2018
WordPress Installer
View WordPress.sh
#!/bin/bash
# LXC.systems - Cloud Script - https://lxc.systems/cloud-script/MQCeGU1
#
# Title -------: WordPress Install
# Description -: This cloud script will install all base system packages, a LAMP server and the latest version of WordPress. It will work on any Ubuntu server from version 12.04 to 17.04.
# Created -----: June 17th 2017, 8:58pm
# Updated -----: June 21st 2017, 12:09am
# Usage ------: wget -O - https://lxc.systems/cloud-script/MQCeGU1 | sudo sh
# bash <(curl -s https://lxc.systems/cloud-script/MQCeGU1)
View CSS inline custom properties.md

CSS inline custom properties

Markup

<div class="el" 
style="
   --spacetop:40px;
   --spaceleft:20px;
   --spacetopmobile:10px;
   --spaceleftmobile:5px
@lcherone
lcherone / write_ini_file.md
Created Jan 24, 2018
PHP write_ini_file implementation
View write_ini_file.md

Below is an implementation of write_ini_file() which PHP is currently lacking, it will create an almost identical (except comments) of the input:

  • Supports cross platform (PHP_EOL) new lines added between sections.
  • Handles both index and key value arrays.
  • Handles CONSTANT style values.
  • And file locking to stay consistent.

Source

<?php
View ubuntu.releases.json
{
"current": [
{
"version": "Ubuntu 17.10",
"codename": "Artful Aardvark",
"release_date": "October 19, 2017",
"end_of_life": "July 2018",
"links": [
"https://wiki.ubuntu.com/ArtfulAardvark",
"https://wiki.ubuntu.com/ArtfulAardvark/ReleaseNotes",
@lcherone
lcherone / 33.php
Created Jan 18, 2018
Tiny procedural MVC example, with template and nested views.
View 33.php
<?php
// passed from rewrite
$_GET['controller'] = ''; // index page
// controllers map
$controllers = [
'' => 'index.php',
'foobar' => 'foobar.php'
];
View php.md

You can achieve this by using the [modulus operator][1].

<?php
$result = [
    ['id' => 1, 'product_name' => 'a'],  
    ['id' => 2, 'product_name' => 'b'],  
    ['id' => 3, 'product_name' => 'c'],  
    ['id' => 4, 'product_name' => 'd'],  
    ['id' => 5, 'product_name' => 'e'],  
    ['id' => 6, 'product_name' => 'f'],  
You can’t perform that action at this time.