This file contains hidden or 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
#!/bin/bash | |
# Argument is path + filename of .sql file dump. | |
mysql database_name -u user_name -p --host=127.0.0.1 --port=33060 < $1 |
This file contains hidden or 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
<div id="progress-bar"><div style="width:0;"></div> | |
<script> | |
let progressBar = document.querySelector("#progress-bar div") | |
let items = []; | |
for (let index = 0; index <= 100; index++) { | |
items.push(index); | |
} | |
This file contains hidden or 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 | |
/** | |
* Bootstrap macros in Service Provider. | |
* | |
* @return void | |
*/ | |
public function boot() | |
{ | |
// Build form error macro to easily set inline error labels. | |
Form::macro('errorMessage', function($field) { |
This file contains hidden or 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
// Fetch storage item if it exists and set element value | |
function updateFieldValueFromStorage(elementId, storageKey) { | |
let storage = window.localStorage; | |
if (storage.getItem(storageKey)) { | |
($('#' + elementId).val(storage.getItem(storageKey))); | |
} | |
} |
This file contains hidden or 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
// Set field value for element if it has a value | |
function setFieldValueInStorage(elementId, storageKey) { | |
if (window.localStorage) { | |
let storage = window.localStorage; | |
// If no value, remove item. Otherwise store. | |
if ($('#' + elementId).val()) { | |
storage.setItem(storageKey, $('#' + elementId).val()); | |
} else { | |
storage.removeItem(storageKey); |
This file contains hidden or 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
function toTitleCase(string) { | |
return string.replace( | |
/\w\S*/g, | |
function(text) { | |
return text.charAt(0).toUpperCase() + text.substr(1).toLowerCase(); | |
} | |
); | |
} |
This file contains hidden or 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
function buildOption(value, text, selected) { | |
return $("<option/>", { | |
value: value, | |
text: text, | |
selected: selected | |
}); | |
} | |
// Usage: | |
// $('#myselect').append(buildOption(key, value, selected)); |
This file contains hidden or 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 | |
/** | |
* Generates a hash for each nested array in the data set. | |
* Sets itself as the parent key - useful for comparisons. | |
* | |
* @param array $dataArray | |
* @param array $preserveFields Fields to return but not include in hash | |
* @return array $updatedArray | |
*/ | |
private function setHashKeys(array $dataArray, array $preserveFields = []) |
This file contains hidden or 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
echo Enter project directory name | |
read dirname | |
echo Setting permissions for $dirname... | |
sudo chown -R $USER:www-data /var/www/$dirname/storage | |
sudo chown -R $USER:www-data /var/www/$dirname/bootstrap/cache | |
chmod -R 775 /var/www/$dirname/storage | |
chmod -R 775 /var/www/$dirname/bootstrap/cache |