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
var a = "joe tom dave mike mark sue lauren".split(" "), b = 0, c = a, d, e, f, g = c.length; | |
for (d = 0;d < g;d++) { | |
f = ~~(Math.random() * (d + 1)), e = c[d], c[d] = c[f], c[f] = e; | |
} | |
for (a = c;b < a.length;) { | |
console.log(a[b] + " => " + (b + 1 < a.length ? a[b + 1] : a[0])), b++; | |
} | |
; |
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
#thanks to http://forums.cpanel.net/f354/how-move-mysql-data-directory-110481.html#post861642 and | |
#http://forums.cpanel.net/f354/how-move-mysql-data-directory-110481-p2.html#post1055762 | |
#1. fallback dump | |
mysqldump --opt --all-databases | gzip > /home/alldatabases.sql.gz | |
#2. create new mount point | |
mkdir /var/lib/mysqltmp | |
#3. Configure /etc/fstab so that the new partition is mounted when the server boots (adjust values as necessary) |
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 | |
/* | |
This is a fork of https://gist.github.com/frzsombor/ddd0e11f93885060ef35 | |
Thanks frzsombor! | |
|-------------------------------------------------------------------------- | |
| Checking the Sentry Auth for CKFinder CheckAuthentication | |
|-------------------------------------------------------------------------- | |
| Put in the CKFinder config.php within the CheckAuthentication() function. | |
| |
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
Works in the laravel regex as part of an array. | |
Covers with http,https and none. | |
requires a 2 letter domain extension. | |
/^((http|https)\:\/\/|)[\w+\.]+[\w]+$/ | |
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
sudo echo "[default]" >> ~/Library/Preferences/nsmb.conf; | |
echo "smb_neg=smb1_only" >> ~/Library/Preferences/nsmb.conf |
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
/* Author: http://www.minimit.com/articles/solutions-tutorials/bootstrap-3-responsive-columns-of-same-height, stored here for easy reference */ | |
/* USAGE | |
<div class="row"> | |
<div class="row-height"> | |
<div class="col-xs-2 col-xs-height col-xs-middle"> | |
<div class="inside"></div> | |
</div> | |
<div class="col-xs-4 col-lg-5 col-xs-height col-xs-middle"> | |
<div class="inside"></div> | |
</div> |
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 | |
//Based on composer require google/api-client:^1.1 | |
$filename = $_FILES['file']['name']; | |
$type = $_FILES['file']['type']; | |
$tmp_name = $_FILES['file']['tmp_name']; | |
$newurl = '/media/' . $filename; |
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
// Not my code | |
// Code from here: http://www.minimit.com/articles/solutions-tutorials/bootstrap-3-open-only-one-modal-at-time | |
// Storing here for reference | |
var modalUniqueClass = ".modal"; | |
$('.modal').on('show.bs.modal', function(e) { | |
var $element = $(this); | |
var $uniques = $(modalUniqueClass + ':visible').not($(this)); | |
if ($uniques.length) { | |
$uniques.modal('hide'); |
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 | |
// tested here: https://regex101.com/r/iC1uQ4/1 | |
// as laravel validation rule: 'regex:/^((http|https)\:\/\/|)([\w]+\.)+\w+($|[\w\/\.]+$|[\w\/\.]+\?[\w\=\&\.]+$)/' | |
$re = "/^((http|https)\:\/\/|)([\w|\-]+\.)+\w+($|[\w\-\/\.]+$|[\w\/\.]+\?[\w\=\&\.]+$)/"; | |
$str = "www.example.com/metropolitanlondon"; | |
preg_match($re, $str, $matches); | |
/* |
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
## Add correct content-type for fonts | |
AddType application/vnd.ms-fontobject .eot | |
AddType application/x-font-ttf .ttf | |
AddType application/x-font-opentype .otf | |
AddType application/x-font-woff .woff | |
AddType image/svg+xml .svg | |
## Fix other types | |
AddType text/javascript .js | |
AddType text/css .css |
OlderNewer