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
<? | |
# 1 | |
foreach (glob(resource_path() . '/lang/*/*.php') as $file) { | |
preg_match('#^.*/([A-z]*)/([A-z]*).php$#', $file, $matches); | |
$trans[$matches[1]][$matches[2]] = require($file); | |
} | |
foreach ($trans as $lang => $translations) { | |
$fileContents = sprintf('var trans = %s;', json_encode($translations)); | |
file_put_contents(public_path() . '/js/trans.' . $lang . '.js', $fileContents); |
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
# Allow execution | |
# chmod +x ./setperms.sh | |
# Usage | |
# ./setperms.sh /var/www/domain.com | |
cd $1 | |
sudo chown -R $USER:www-data . | |
sudo find . -type f -exec chmod 664 {} \; | |
sudo find . -type d -exec chmod 775 {} \; |
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 | |
/** | |
* Get the hash of the current git HEAD | |
* @param str $branch The git branch to check | |
* @return mixed Either the hash or a boolean false | |
*/ | |
function get_current_git_commit( $branch='master' ) { | |
if ( $hash = file_get_contents( sprintf( '.git/refs/heads/%s', $branch ) ) ) { | |
return $hash; | |
} else { |