This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); | |
/** | |
* Custom PSR-4 autoloader | |
* | |
* @param array $packages: array of packages | |
* @source https://github.com/Wilkins/composer-file-loader | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// target directory path | |
$target = __DIR__.'/./thumbs'; | |
/** | |
* Delete folder and contents recursively | |
* | |
* @param string $target: target dir path | |
* @return bool|null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```csharp | |
// açık olan formlar içinde dönelim | |
foreach (Form form in Application.OpenForms.OfType<Form>().ToList()) | |
{ | |
if (form.Name == "Form2") | |
{ | |
// Form2'nin içindeki controller içinde dönelim | |
foreach (Control control in form.Controls) | |
{ | |
if (control.Name == "pictureBox1") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Drawing; | |
using System.Windows.Forms; | |
namespace TestaWFA | |
{ | |
public partial class Form1 : Form | |
{ | |
public Form1() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Hex to RGBa | |
* | |
* @param string $color: hex color | |
* @param bool|float $opacity: alpha channel, optional | |
* @param string $default: default return value | |
*/ | |
function hex2rgba($color, $opacity = false, $default = 'rgb(0,0,0)') | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[DllImport("gdi32.dll")] | |
static extern int GetDeviceCaps(IntPtr hdc, int nIndex); | |
private void Button_Click(object sender, RoutedEventArgs e) | |
{ | |
Graphics graphics = Graphics.FromHwnd(IntPtr.Zero); // using System.Drawing; (add from referances) | |
IntPtr desktop = graphics.GetHdc(); | |
int monitorHeight = GetDeviceCaps(desktop, 6); | |
int monitorWidth = GetDeviceCaps(desktop, 4); | |
Content = $"Height: {monitorHeight} mm., Width: {monitorWidth} mm. This Monitor Size: {Math.Sqrt(Math.Pow(monitorHeight, 2) + Math.Pow(monitorWidth, 2)) / 25,4:#,##0.00} inch."; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[DllImport("gdi32.dll")] | |
static extern int GetDeviceCaps(IntPtr hdc, int nIndex); | |
private void Button_Click(object sender, RoutedEventArgs e) | |
{ | |
Graphics graphics = Graphics.FromHwnd(IntPtr.Zero); // using System.Drawing; (add from referances) | |
IntPtr desktop = graphics.GetHdc(); | |
int monitorHeight = GetDeviceCaps(desktop, 6); | |
int monitorWidth = GetDeviceCaps(desktop, 4); | |
Content = $"Height: {monitorHeight} mm., Width: {monitorWidth} mm. This Monitor Size: {Math.Sqrt(Math.Pow(monitorHeight, 2) + Math.Pow(monitorWidth, 2)) / 25,4:#,##0.00} inch."; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private bool AutoFolderCreate(int incrementCount = 1) | |
{ | |
var targetPath = Directory.GetCurrentDirectory() + "\\Saves"; | |
if (Directory.Exists(targetPath)) | |
{ | |
var newDirName = Directory.EnumerateDirectories(targetPath) // list of sub directories in target | |
.Select(Path.GetFileName) // get directory/file name | |
.Where(n => n.All(Char.IsDigit)) // get only digits | |
.Select(int.Parse) // string parse to int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get time elapsed string from given between dates by human readable format | |
* | |
* @param string $date_now: current date | |
* @param string $date_old: target old date | |
* @param bool $full: need full date ago string | |
* | |
* @see source: https://stackoverflow.com/a/18602474 | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Date comparer | |
* | |
* @param string $date: current date | |
* @param string $date2: target date | |
* @param bool $diff: date diff or past time condition | |
* @return bool|array | |
*/ | |
public function dateCompare($current, $expire, $diff = false) | |
{ |