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
<?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
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
```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
<?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
<?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
<script src="Chart.bundle.js"></script> | |
<?php | |
$host = 'localhost'; | |
$username = 'root'; | |
$password = ''; | |
$db_name = 'tes'; | |
$conn = new PDO("mysql:host={$host};dbname={$db_name}", $username, $password); | |
$conn->exec("set names utf8"); | |
$conn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); |
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 | |
namespace App\Helpers; | |
/** | |
* Numbers more readable for humans | |
* It intends to change numbers as 1000 as 1K or 1200000 as 1.2M | |
* This code is heavly base in this one: https://gist.github.com/RadGH/84edff0cc81e6326029c | |
* How to use \NumberFormat::readable(1000); | |
* |
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 | |
namespace App\Providers; | |
use Illuminate\Support\ServiceProvider; | |
use Illuminate\Support\Facades\Blade; | |
use Illuminate\Support\Facades\File; | |
class AppServiceProvider extends ServiceProvider | |
{ |