Skip to content

Instantly share code, notes, and snippets.

View halityurttas's full-sized avatar

Halit YURTTAŞ halityurttas

View GitHub Profile
@halityurttas
halityurttas / default.conf
Created July 30, 2023 17:50
vscode server nginx settings
location / {
proxy_pass http://127.0.0.1:8443/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
@halityurttas
halityurttas / fl.ps2
Created January 7, 2023 20:19
file list
PS D:\> Get-ChildItem -Path D:\LogTest\FTP-02\ -File -Recurse | Format-List FullName
@halityurttas
halityurttas / koSelect2MultipleBinding.js
Created November 5, 2022 22:32
Select2 Multiple Custom Binding
ko.bindingHandlers.select2multiValues = {
init: function(element, valueAccessor, allBindings, viewModel, bindingContext) {
$(element).select2({multiple: true});
$(element).val(valueAccessor()()).trigger('change');
$(element).on('select2:select', function (e) {
valueAccessor()($(element).val());
});
$(element).on('select2:unselect', function (e) {
valueAccessor()($(element).val());
});
@halityurttas
halityurttas / randomnumber.sql
Created June 8, 2022 20:39
Satır bazında random number üretme
SELECT (((CAST( ABS(CHECKSUM(NewId())) % 10 AS DECIMAL)+1)/10)+1), * FROM table1
@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 */
}