Skip to content

Instantly share code, notes, and snippets.

View garyconstable's full-sized avatar
🏠
Working from home

Gary Constable garyconstable

🏠
Working from home
View GitHub Profile
@garyconstable
garyconstable / ellipsis.php
Created October 7, 2019 08:52
Ellipsis (php)
<?php
/**
* Take the landing page content, strip the tags and return an shortened versions.
*
* @param $text
* @param bool $strip_tags
* @param int $max_length
* @param string $cut_off
* @param bool $keep_word
@garyconstable
garyconstable / missing-mysql-sock.md
Last active September 25, 2019 08:03
Missing Mysql sock

rm -rvf /var/lib/mysql/ib_logfile*

touch /var/lib/mysql/mysql.sock

touch /var/lib/mysql/mysql.pid

chown -R mysql:mysql /var/lib/mysql

systemctl restart mysql

@garyconstable
garyconstable / upload.php
Last active September 4, 2019 11:01
Laravel upload an image
<?php
function store(Request $request)
{
$this->validateImage($request);
$image = new Image();
$file = $request->file('file');
@garyconstable
garyconstable / docker-cleanup-resources.md
Created July 20, 2019 13:23 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@garyconstable
garyconstable / readme.md
Created July 8, 2019 20:49
Project Brief

Project

We’d like you to build an administrated user system which allows users to comment on other peoples profiles.

Here are the requirements:

  • A login and registration system - users must be authenticated to do any of the following.
  • A page where users can view all the users on the system (including themselves).
  • Each listing should only show the user’s name, and when they were last updated.
  • Each user must have a profile page that can be navigated to from the listings page.
@garyconstable
garyconstable / README.MD
Last active July 17, 2019 21:14
Work Examples
@garyconstable
garyconstable / quest.md
Last active June 4, 2019 21:01
Quest comands
adb install -r vr_0005.apk 

adb kill-server&&adb start-server

@garyconstable
garyconstable / Environments to bypass .htpasswd protection
Created May 9, 2019 11:41 — forked from tomschlick/Environments to bypass .htpasswd protection
This allows you to set certain urls/domains that are allowed to bypass a htpasswd protection layer, which is very useful for multiple environment setups (developement, staging, production)
#allows a single uri through the .htaccess password protection
SetEnvIf Request_URI "/testing_uri$" test_uri
#allows everything if its on a certain host
SetEnvIf HOST "^testing.yoursite.com" testing_url
SetEnvIf HOST "^yoursite.com" live_url
Order Deny,Allow
AuthName "Restricted Area"
AuthType Basic
@garyconstable
garyconstable / mage2.md
Last active April 11, 2019 22:21
Magento 2 commands

Download Mage 2

composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition .

Change Folder Permissions

find . -type d -exec chmod 700 {} \; && find . -type f -exec chmod 600 {} \;
@garyconstable
garyconstable / Readme.md
Last active May 12, 2019 22:37
Docker Commands

Docker compose up (build)

docker-compose up -d

Find IP Address of container:

docker inspect test1-mariadb | grep IPAddress

Use the command to get a bash shell in the container.