Skip to content

Instantly share code, notes, and snippets.

View glmdev's full-sized avatar
🍵
Migrated to Gitea!

Garrett Mills glmdev

🍵
Migrated to Gitea!
View GitHub Profile
@glmdev
glmdev / lamp.sh
Last active March 29, 2017 22:06
#!/bin/sh
# For setting up a basic LAMP server on Ubuntu.
apt install apache2
a2enmod rewrite
nano /etc/apache2/apache2.conf
apt install mysql-server -y
mysql_secure_installation
@glmdev
glmdev / c927.sh
Created February 6, 2017 02:39
Updates Cloud9 workspaces and initializes a PHP7 Laravel workspace.
sudo apt-get install software-properties-common -y
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update && sudo apt-get purge php5-fpm -y && sudo apt-get --purge autoremove -y && sudo apt-get install php7.0-fpm php7.0-mysql php7.0-curl php7.0-gd php7.0-json php7.0-mcrypt php7.0-opcache php7.0-xml -y
sudo apt-get install php7.0-mbstring -y
sudo service php7.0-fpm restart
@glmdev
glmdev / isMobile.js
Created February 6, 2017 02:31
Checks if the client is using a mobile browser.
/* Coded by Garrett Mills
* http://glmdev.tech/my/code
* Last Edited on 5 February 2017 11:00
* This code is licensed under GNU GPL 3.0
*/
var isMobile = false; //initiate as false
// device detection
if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)
|| /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|
@glmdev
glmdev / url.js
Created December 31, 2016 18:47
Simple script to recreate PHP's GET variables in JavaScript.
/* Coded by Garrett Mills
* http://glmdev.github.io/
* Last Edited on 31 December 2016 12:45
* This code is licensed under the GNU GPL v3.0
*/
//To use, simply execute the script as the first item in the head tag
var ctr1 = 0
var ctr2 = 0
@glmdev
glmdev / pleasantpass.py
Created November 11, 2016 06:20
Generates strong passwords with a focus on speed and alternating typing hands.
# Pleasant Password Generator: Generates strong passwords with a focus on speed
# Copyright (C) 2016 Garrett Mills
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@glmdev
glmdev / retinacheck.js
Created August 6, 2016 20:12
Simple function to check if the client has retina support.
function __isRetinaDisplay() {
if (window.matchMedia) {
var mq = window.matchMedia("only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3), only screen and (min-resolution: 1.3dppx)");
return (mq && mq.matches || (window.devicePixelRatio > 1));
}
}
window.isRetina = __isRetinaDisplay();