Skip to content

Instantly share code, notes, and snippets.

@tahsingungordu
tahsingungordu / turkish-lowercase-uppercase.js
Created June 18, 2017 22:36
javascript - Turkish character lowercase and uppercase functions.
String.prototype.turkishToUpper = function(){
var string = this;
var letters = { "i": "İ", "ş": "Ş", "ğ": "Ğ", "ü": "Ü", "ö": "Ö", "ç": "Ç", "ı": "I" };
string = string.replace(/(([iışğüçö]))/g, function(letter){ return letters[letter]; });
return string.toUpperCase();
};
String.prototype.turkishToLower = function(){
var string = this;
var letters = { "İ": "i", "I": "ı", "Ş": "ş", "Ğ": "ğ", "Ü": "ü", "Ö": "ö", "Ç": "ç" };
@tahsingungordu
tahsingungordu / bymega_breadcrumb.php
Last active June 3, 2017 02:26
Create breadcrumb on the Wordpress with Bootstrap
/**
* Create breadcrumb on the Wordpress with Bootstrap
*
* @param string $current : The last title with no link
*
* @return string
*/
function bymega_breadcrumb($current = '')
{
// Homepage added
@tahsingungordu
tahsingungordu / bymega_filter_image_sizes.php
Last active June 3, 2017 02:18
Disable auto creation of the available image sizes on Wordpress
/**
* Disable auto creation of the available image sizes on Wordpress
*
* See: https://developer.wordpress.org/reference/hooks/intermediate_image_sizes_advanced/
*/
add_filter('intermediate_image_sizes_advanced', 'bymega_filter_image_sizes');
function bymega_filter_image_sizes ($sizes) {
// Example: disable auto creation of the size medium_large
unset( $sizes['medium_large'] );
1) php artisan make:middleware LogLastUserActivity
2) app/Http/Middleware/LogLastUserActivity.php
if(Auth::check()) {
$expiresAt = Carbon::now()->addMinutes(5);
Cache::put('user-is-online-' . Auth::user()->id, true, $expiresAt);
}
3) app/Http/Kernel.php
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
@tahsingungordu
tahsingungordu / wp-query-ref.php
Created October 7, 2016 19:38 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@tahsingungordu
tahsingungordu / gist:351cebbce94e63aef1ce8910642b4c8e
Created September 2, 2016 19:59 — forked from danielbachhuber/gist:7126249
Include posts from authors in the search results where either their display name or user login matches the query string
<?php
/**
* Include posts from authors in the search results where
* either their display name or user login matches the query string
*
* @author danielbachhuber
*/
add_filter( 'posts_search', 'db_filter_authors_search' );
function db_filter_authors_search( $posts_search ) {
@tahsingungordu
tahsingungordu / location.php
Created June 19, 2016 17:05 — forked from ferdiunal/array2json.php
Ülkelerin İl, İlçeleri. Şimdilik Türkiye'yi ekleyebildim.
<?php
/**
* Created by PhpStorm.
* User: ferdiunal
* Date: 19.06.2016
* Time: 14:35
*/
return[
/***
* Turkey - Türkiye
@tahsingungordu
tahsingungordu / BlogController.php
Created June 17, 2016 20:47 — forked from tobysteward/BlogController.php
Laravel AJAX Pagination with JQuery
<?php
class BlogController extends Controller
{
/**
* Posts
*
* @return void
*/
public function showPosts()
@tahsingungordu
tahsingungordu / strikethrough.html
Created March 27, 2016 18:55
Strikethrough on text with Css3
<style>
.strikethrough {
position: relative;
}
.strikethrough:before {
position: absolute;
content: "";
left: 0;
top: 50%;
right: 0;
@tahsingungordu
tahsingungordu / split.js
Created March 27, 2016 18:46
Javascript ile belirlediğiniz özel karakterlere göre parçalama
var a = "bymega.com";
var temp = new Array();
temp = a.split('.');
console.log(temp);