Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

<?php
///////////////////////////////////////////////////
// STEP 1 - CREATE CLASS THAT WILL BE USED GLOBALY
///////////////////////////////////////////////////
namespace App\MyApp;
class MyApp {
public function sayHello($data = [])
{
echo "Hello World from Facade!";
}
@gradosevic
gradosevic / gulpfile_react.js
Last active November 24, 2022 06:27
Working gulpfile.js with gulp-babel ES6 and React
var gulp = require('gulp');
var babel = require("gulp-babel");
var sourcemaps = require('gulp-sourcemaps');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
gulp.task('default', () => {
return gulp.src('js/main.js')
.pipe(sourcemaps.init())
.pipe(babel({
@gradosevic
gradosevic / README.md
Created May 27, 2021 10:00 — forked from nichtich/README.md
How to automatically deploy from GitHub

Deploy your site with git

This gist assumes:

  • you have an online remote repository (github / bitbucket etc.)
  • you have a local git repo
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by Apache
  • the Apache user is named www-data (may be apache on other systems)
@gradosevic
gradosevic / wordpress_search_in_custom_fields.php
Last active October 14, 2021 23:18
WordPress: Search in ACF fields, functions.php
<?php
///////////////////////////////////
/// SUPPORT FOR SEARCHING IN ACF
///////////////////////////////////
/* Join posts and post-meta tables
*
* http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_join
*/
function cf_search_join( $join ) {
global $wpdb;
@gradosevic
gradosevic / LINUX.md
Last active October 8, 2021 09:51
Linux commands
#change owner and permissions recursively
sudo chmod -R 775  /ROOT_OF_YOUR_APP/vendor/
sudo chown -R $USER:$USER /ROOT_OF_YOUR_APP/vendor/

#impersonate as www-data in command line
sudo su www-data -s /bin/sh


#Homestead box swithc PHP version
@gradosevic
gradosevic / GIT.md
Last active May 27, 2021 08:35
GIT

Ignore already added file to .gitignore

git update-index --assume-unchanged file.txt

Remember credentials

git config --global credential.helper store

@gradosevic
gradosevic / laravel-valet-use-public-folder-with-any-name.md
Last active December 29, 2020 08:40
Laravel Valet use any folder as public

If you've used Valet, you know you have to put your assets in a folder called "public" for it to serve your site or app properly. My host requires that I put my public assets in a folder called "public_html". Some people aren't able to change this without the help of their host. Or maybe you can, but this is much easier!

So, here's the tip.

Use whatever name you want for your public assets folder. (In my case, "public_html"). In Terminal, make sure you are in your project root directory Create a symlink to that folder: ln -s /Your/Path/To/public_html public And you're done! Valet will now see the "public" symlink and serve your site without a hitch.

Hint: You'll probably want to add the new public folder to your .gitignore file

@gradosevic
gradosevic / v3_captcha.html
Last active February 8, 2020 13:57
V3 Invisible Captcha
<form>
<input type="hidden" id="g-recaptcha-response" name="g-recaptcha-response" />
<script src="https://www.google.com/recaptcha/api.js?render=PUBLIC_KEY"></script>
<script>
grecaptcha.ready(function() {
grecaptcha.execute('PUBLIC_KEY', {action: 'homepage'}).then(function(token) {
document.getElementById('g-recaptcha-response').value = token;
});
});
@gradosevic
gradosevic / wp-setup-checklist.php
Last active March 15, 2019 18:27
WordPress Setup Checklist
<?php
//Links
//https://www.codeinwp.com/blog/secure-your-wordpress-website/
//Upload backups script
//https://olivermarshall.net/how-to-upload-a-file-to-google-drive-from-the-command-line/
/////////////////////////////
@gradosevic
gradosevic / WPSnippets.php
Last active March 9, 2019 10:17
WP Snippets
<?php
//Allow AGCA plugin access only to one person, specified by username
function agca_access_only_admin(){
if(is_admin()){
$screen = get_current_screen();
if($screen->id === 'tools_page_ag-custom-admin/plugin'){
$user = wp_get_current_user();
//Update this ////////////////////
$accessAllowedOnlyTo = 'admin';