Skip to content

Instantly share code, notes, and snippets.

View enginkartal's full-sized avatar

Engin Kartal enginkartal

View GitHub Profile
@enginkartal
enginkartal / js-turkish-to-english.js
Last active April 22, 2024 13:11
Javascript Turkish character to english characters change
String.prototype.turkishtoEnglish = function () {
return this.replace('Ğ','g')
.replace('Ü','u')
.replace('Ş','s')
.replace('I','i')
.replace('İ','i')
.replace('Ö','o')
.replace('Ç','c')
.replace('ğ','g')
.replace('ü','u')
@enginkartal
enginkartal / es-import-bulk
Created March 21, 2016 20:08
es-import-bulk
es-import-bulk --url http://localhost:9200 --file data.json
@enginkartal
enginkartal / es-export-bulk.js
Created March 21, 2016 20:02
es-export-bulk
es-export-bulk --url elasticsearch-ip --file path-adresi --index es-index-adı
es-export-bulk --url http://localhost:9200 --file data.json --index myIndex
@enginkartal
enginkartal / elasticsearch-tool-install.js
Created March 21, 2016 19:37
elasticsearch-tool-install
npm install -g elasticsearch-tools
@enginkartal
enginkartal / laravel5-nginx-virtualhost
Last active November 8, 2019 10:22
Laravel 5 - Nginx Virtual Host Conf
server {
listen 80;
root /usr/share/nginx/html/laravel/public;
index index.php index.html index.htm;
server_name laravel.dev;
location / {
try_files $uri $uri/ /index.php?$query_string;
@enginkartal
enginkartal / mongodb-remove.js
Created December 27, 2015 17:01
MongoDB Remove
//Author: Engin Kartal
//Blog Post: http://enginkartal.com.tr/mongodb-remove/
db.collection.remove(
<query>,
{
justOne: <boolean>,
writeConcern: <document>
}
)
@enginkartal
enginkartal / mongodb-logical-operators.js
Last active December 27, 2015 16:38
MongoDB Logical Operators
//Author: Engin Kartal
//Blog Post: http://enginkartal.com.tr/mongodb-mantiksal-logical-operatorler/
//AND operatörü
//Aşağıdaki sorgu bize geri author="Engin Kartal" ve "likes" sayısı 5'e eşit olan kayıtları döner.
db.content.find({$and:[{author:'Engin Kartal'},{likes:5}])
//author="Engin Kartal" ve "likes" sayısı 10'dan az olan kayıtlar
db.content.find({$and:[{author:{$eq:'Engin Kartal'}},{likes:{$lt:10}}])
//OR operatörü
@enginkartal
enginkartal / mongodb-comparison-operators.js
Created December 20, 2015 20:53
MongoDB Comparison Operators
//Author: Engin Kartal
//Blog Post: http://enginkartal.com.tr/mongodb-karsilastirma-operatorleri/
//eq operatörü :: Eşittir
//Aşağıdaki sorgu bize geri "likes" sayısı 7'ye eşit olanları döner.
db.content.find({likes:{$eq:7}})
//ne(not equal) operatörü :: Eşit Değildir.
//Aşağıdaki sorgu bize geri "author"u "Engin Kartal"'a eşit olmayan kayıtları döner.
db.content.find({author:{$ne:'Engin Kartal'}})
@enginkartal
enginkartal / mongod-rename.js
Created November 30, 2015 09:51
mongodb-rename
//content dokümanındaki tüm 'url' fiedlarının adını link olarak değiştiriyoruz.
db.content.update({},{$rename:{'url':'link'}},false,true)
@enginkartal
enginkartal / mongodb-single-index.js
Created November 21, 2015 23:59
MongoDB Single Index
//aşağıdaki şekilde author küçükten büyüğe indexlenir.
db.content.createIndex("author":1)
//aşağıdaki şekilde ise author büyükten küçüğe indexlenir.
db.content.createIndex("author":-1)