Ubuntu server firewall install and setting

How To Set Up a Firewall with UFW on Ubuntu 14.04?: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-14-04

Some UFW command:

sudo apt-get install ufw [install]

sudo ufw default deny incoming
sudo ufw default allow outgoing

sudo ufw allow ssh
sudo ufw allow 22 [or your ssh port]

sudo ufw allow http
sudo ufw allow https

sudo ufw allow [port for your web admin!]

sudo ufw allow ftp
sudo ufw deny ftp

sudo ufw allow 22
sudo ufw deny 22

sudo ufw disable

sudo ufw status verbose

sudo ufw enable

Top 30 PHP Interview Questions and Answers for beginners and experts.

Question : How can we encrypt password using PHP?
Answer : crypt () function is used to create one way encryption. It takes one input string and one optional parameter.

Question :How to scrape data from website using CURL?
Answer : To scrap the data from website, Website must be public and open for scrapable.
In the blow code, just update the CURLOPT_URL to which websites data you want to scrap.

https://intellipaat.com/interview-question/php-interview-questions

Streaming radio with PHP (Laravel)!!

Koel – A personal music streaming server that works. One of the best Laravel apps.

Koel (also styled as koel, with a lowercase k) is a simple web-based personal audio streaming service written in Vue at the client side and Laravel on server side. Targeting web developers, Koel embraces some of the more modern web technologies – flexbox, audio, and drag-and-drop API to name a few – to do its job.

source:
http://learninglaravel.net/a-personal-music-streaming-server-that-works

http://koel.phanan.net/

https://github.com/phanan/koel

Programmer salary calculator

When it comes to negotiating a salary with a company that you want to work with, it’s hard to know where to start, especially if you don’t have a good baseline for what other people with similar skills are being paid.

A salary calculator is a good way to get data on how much similar jobs are paying, so you can go into a salary negotiation prepared.

https://hired.com/salary

If you want to know what you’re worth, Hired has the answer: with data from thousands of real interview requests and job offers, we’ve put together a salary calculator that can tell you what you could be making in your job based on the skills you have.

If you want to find out how much more you could actually earn, join Hired. Just set up your profile, and companies will give you job offers with salary and equity upfront before you interview. Get multiple job offers from top companies with just 1 application.

PHP WordPress Plugin Tutorial | Development

Getting Started with WordPress Plugin Development: The Ultimate Guide (2015 Jan): https://premium.wpmudev.org/blog/wordpress-plugin-development-guide/

How To Create A WordPress Plugin (2014 Jul): https://www.elegantthemes.com/blog/tips-tricks/how-to-create-a-wordpress-plugin

Plugin API/Action Reference/the post: https://codex.wordpress.org/Plugin_API/Action_Reference/the_post#Example

Actions Run During a Typical Request: https://codex.wordpress.org/Plugin_API/Action_Reference

One drawback of WordPress development is that WordPress was released before PHP 5, so much of the WordPress code is procedural and can be difficult to organize.

PHP WordPress Plugin Tutorial using Object Oriented Programming Part 1: Advanced Features – Pak PHP Micro Framework package blog: http://www.phpclasses.org/blog/package/9505/post/2-PHP-WordPress-Plugin-Tutorial-using-Object-Oriented-Programming-Part-1-Advanced-Features.html

Contents
Introduction
How to Translate your plugin
How to Create a Simple Settings Page for your Plugin
How to create a Dashboard Widget
How to Make AJAX Calls
How to Create Custom Post Types and Taxonomies
How to Unit Test Your Plugin by Extending the WordPress XML-RPC interface
How to include third party scripts
Conclusion

PHP WordPress Plugin Tutorial using Object Oriented Programming Part 1: Basic Example – Pak PHP Micro Framework package blog: http://www.phpclasses.org/blog/package/9505/post/1-PHP-WordPress-Plugin-Tutorial-using-Object-Oriented-Programming-Part-1-Basic-Example.html

WordPress and Laravel: https://laravel-news.com/2016/01/wordpress-and-laravel/

A popular way of setting up a site like this is to use WordPress as the admin and then build out the frontend in a framework such as Laravel.

WordPress Corcel (under DEVelopment)

This way you can use WordPress as back-end, to insert posts, custom types, etc, and you can use what you want in front-end, like Silex, Slim Framework, Laravel, Zend, or even pure PHP (why not?).

Using WordPress with Lumen: http://adampatterson.ca/blog/2015/06/using-wordpress-with-lumen/

Removes duplicates values from an multidimensional array (PHP)

The idea: Serialize the item of the item (array) of the multidimensional array

Than Sort out the same item.

// serialize — Generates a storable representation of a value
$workArr =array();
foreach ($newDateArr as $value) {
$workArr[]= serialize ( $value );
}

$workArr = array_unique($workArr);

//unserialize — Creates a PHP value from a stored representation
$workArr2 =array();
foreach ($workArr as $value) {
$workArr2[]= unserialize( $value );
}

other source – but this was not worked for me:

How to remove duplicate values from a multi-dimensional array in PHP

http://stackoverflow.com/questions/307674/how-to-remove-duplicate-values-from-a-multi-dimensional-array-in-php

Storing HTML Form data locally

<script type=”text/javascript”>

$(document).ready(function() {

var formElements = {};
var current_siteurl = window.location.href;
//console.log( ‘current_siteurl: ‘+ current_siteurl);

//WRITE
$(“form :input”).each(function(){
var input = $(this);
// console.log( input.attr(‘name’));

$(“textarea[name='”+input.attr(‘name’)+”‘]”).keyup(function() {

// console.log(‘click:’+ $(“textarea[name='”+input.attr(‘name’)+”‘]”).val());
formElements[input.attr(‘name’)]  = $(“textarea[name='”+input.attr(‘name’)+”‘]”).val();
formElements_str = JSON.stringify(formElements);
// A süti neve az aktuális oldal neve, egyedi azonosító
Cookies.set(current_siteurl, formElements_str , { expires: 3 });

});
});

//READ
$(“#show_saved_btn”).click(function() {

formPack_str = Cookies.get(current_siteurl);
//console.log( ‘suti: ‘+ formPack_str);
if(formPack_str){
formPack = JSON.parse(formPack_str);
for (var k in formPack ){
if (formPack.hasOwnProperty(k)) {
$(“textarea[name='”+k+”‘]”).val(formPack[k]);
}
}
}

});
});

</script>

 

 

Autosave form content to Local Storage, a cookie if LS is not available, as changes are made realtime in forms

https://github.com/BenGriffiths/jquery-save-as-you-type

The jQuery.autosave plugin automatically and unobtrusively saves form data based on a set of critera. : https://github.com/nervetattoo/jquery-autosave

Guide to have Persistent Form data using jQuery: http://time2hack.com/2013/09/guide-to-have-persistent-form-data-using-jquery.html

The idea is to store the form data in the cookies and refill tht data if the form is called once again. And if the for submission goes successful; we will just clear the cookies.

JQuery Cookie Lib: https://github.com/js-cookie/js-cookie

Ajax site – sub page url things

Change browser url without page reloading: http://www.tinywall.info/2012/02/change-browser-url-without-page-reload-refresh-with-ajax-request-using-javascript-html5-history-api-php-jquery-like-facebook-github-navigation-menu.html

Demo: http://demo.tinywall.info/html5-history-api/menu1.php

How to make AJAX URLs Crawlable: http://ajax.rswebanalytics.com/seo-for-ajax/#!ajax-crawlable-urls

Solutions to 5 Common Ajax Problems: http://www.webdesignerdepot.com/2009/12/solutions-to-5-common-ajax-problems/

Changing the browser-URL without refreshing page: http://spoiledmilk.com/blog/html5-changing-the-browser-url-without-refreshing-page/

jquery: change the URL address without redirecting? [duplicate]: http://stackoverflow.com/questions/6478485/jquery-change-the-url-address-without-redirecting

Making AJAX applications crawlable: https://developers.google.com/webmasters/ajax-crawling/docs/learn-more

Crossroads.js is a routing library: http://millermedeiros.github.io/crossroads.js/