Skip to content

Instantly share code, notes, and snippets.

@aonurdemir
aonurdemir / jquery.fn.serializeObject.js
Last active September 18, 2015 11:36 — forked from i11v/jquery.fn.serializeObject.js
This function extends jQuery by serializeObject method. Argument — form data, returns object.
;(function ($) {
$.fn.serializeObject = function () {
var obj = {},
arr = this.serializeArray();
$.each(arr, function () {
if (typeof obj[this.name] !== "undefined") {
if (!obj[this.name].push) {
obj[this.name] = [obj[this.name]];
}
@aonurdemir
aonurdemir / php.ini
Last active August 13, 2018 11:29
xdebug phpstorm conf
[xdebug]
zend_extension="c:/wamp64/bin/php/php7.1.16/zend_ext/php_xdebug-2.6.0-7.1-vc14-x86_64.dll"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="c:/wamp64/tmp"
xdebug.show_local_vars=0
@aonurdemir
aonurdemir / ajax.js
Last active March 17, 2020 08:13
File Upload with other post parameters by ajax
$(document).on("click", "#button-send", function () {
const payload = new FormData();
payload.append("param1", $("#param1").val());
payload.append("file",$('#photo-url')[0].files[0]);
$.ajax({
url: "<URL>",
type: 'POST',
data: payload,
processData: false, // tell jQuery not to process the data
@aonurdemir
aonurdemir / tunnel
Last active February 4, 2024 05:17
Tunnel
ssh -L 3308:<DB_MACHINE_HOST_ADDRESS>:3306 -f <USER>@<SSH_MACHINE_HOST_ADDRESS> -p <SSH_PORT> -NnT
DB request to localhost:3308 ->(goes to) <SSH_MACHINE_HOST_ADDRESS>:<SSH_PORT> -> <DB_MACHINE_HOST_ADDRESS>:3306
-L local port forwarding
-f run in background
-T disable psuedo terminal allocation
-Nn disable stdin and execution of commands
@aonurdemir
aonurdemir / jsonvalidator.php
Created October 31, 2017 08:09
JsonValidator
<?php
/**
* Created by PhpStorm.
* User: aonurdemir
* Date: 31/10/2017
* Time: 10:03
*/
class JsonValidator
{
@aonurdemir
aonurdemir / find-conf-path.txt
Last active February 5, 2018 15:13
Find apache conf
[trio@CentOS-65-64-minimal ~]$ps -ef | grep apache
apache 3688 13050 0 Nov26 ? 00:00:24 /usr/sbin/httpd
apache 3690 13050 0 Nov26 ? 00:00:23 /usr/sbin/httpd
apache 3692 13050 0 Nov26 ? 00:00:25 /usr/sbin/httpd
[trio@CentOS-65-64-minimal ~]$ /usr/sbin/httpd -V | grep HTTPD_ROOT
-D HTTPD_ROOT="/etc/httpd"
[trio@CentOS-65-64-minimal ~]$ /usr/sbin/httpd -V | grep SERVER_CONFIG_FILE
@aonurdemir
aonurdemir / commands.txt
Last active February 5, 2018 15:14
find os version
lsb_release -a
uname -a
@aonurdemir
aonurdemir / commands.txt
Last active February 5, 2018 15:13
Apache komutlar
Version göster
$ httpd -v
Install (centos)
$ sudo yum install httpd
Install (centos)
$ sudo service httpd start
Find DocumentRoot
@aonurdemir
aonurdemir / commands
Last active February 5, 2018 15:13
OS user creation
Create a user for your app, named hello and assigned to a system group called webapps.
$ sudo groupadd --system webapps
$ sudo useradd --system --gid webapps --shell /bin/bash --home /webapps/hello_django hello
I like to keep all my web apps in the /webapps/ directory. If you prefer /var/www/, /srv/ or something else, use that instead.
Create a directory to store your application in /webapps/hello_django/ and change the owner of that directory to your
application user hello
$ sudo mkdir -p /webapps/hello_django/
@aonurdemir
aonurdemir / command.txt
Last active February 5, 2018 15:13
Find server ip
ifconfig eth0 | grep inet | awk '{ print $2 }'