Skip to content

Instantly share code, notes, and snippets.

View halityurttas's full-sized avatar

Halit YURTTAŞ halityurttas

View GitHub Profile
@halityurttas
halityurttas / PredicateBuilder.cs
Created February 7, 2022 01:53
Csharp predicate builder
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Collections.Generic;
public static class PredicateBuilder
{
public static Expression<Func<T, bool>> True<T> () { return f => true; }
public static Expression<Func<T, bool>> False<T> () { return f => false; }
@halityurttas
halityurttas / list-table-with-scheme.sql
Created June 23, 2021 22:39
List table with scheme (where in table names)
select schema_name(t.schema_id) + '.' +
t.name as table_name,
t.create_date,
t.modify_date
from sys.tables t
where t.name IN (
'ABC'
)
order by table_name;
@halityurttas
halityurttas / recaptcha2.php
Created May 26, 2021 22:31
ReCaptcha v2 Laravel Validation Rule
<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
class recaptcha2 implements Rule
{
/**
* Create a new rule instance.
@halityurttas
halityurttas / rename_to_lower.ps1
Created May 19, 2021 00:41
Rename all files to lowercase
dir . -r | % { if ($_.Name -cne $_.Name.ToLower()) { ren $_.FullName $_.Name.ToLower() } }
@halityurttas
halityurttas / curl_helper.php
Last active April 10, 2021 12:15
Curl initialize func
<?php
public function get_curl_instance($url, $headers, $fields = null, $is_post = false) {
$curl = curl_init($url);
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $curl, CURLOPT_HEADER, true );
curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $curl, CURLOPT_HTTPHEADER, $headers );
if ( $fields )
curl_setopt( $curl, CURL_POSTFIELDS, $fields );
@halityurttas
halityurttas / stacked-grid-fill-a-row.css
Created March 5, 2021 23:22
Stacked grid with fill a row
.parent-of-rows {
display: grid;
grid-template-rows: auto 1fr auto; /* 1fr fill height row of 3 cols */
}
@halityurttas
halityurttas / side-bar-minmax.css
Created March 5, 2021 23:18
Side bar min max width
.parent-of-columns {
display: grid;
grid-template-columns: minmax(200px, 25%) 1fr; /* 1fr for second col */
}
@halityurttas
halityurttas / flex-base-width.css
Created March 5, 2021 23:13
Flex items with base width
.parent-of-blocks {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.item-as-block {
flex: 1 1 200px; /* Stretching box */
flex: 0 1 200px; /* No stretching box */
margin: 15px;
@halityurttas
halityurttas / super-centered.css
Created March 5, 2021 23:08
Center items on div
.parent-of-centered {
display: grid;
place-items: center;
}
@halityurttas
halityurttas / git-diff-backup.bash
Created February 24, 2021 12:30
copy hiearchical git diff another folder
for file in $(git ls-files --others --exclude-standard --modified); do mkdir -p d://BACKUP/unstageds/$(dirname $file) ; cp $file d://BACKUP/unstageds/$file ; done