Skip to content

Instantly share code, notes, and snippets.

View arisawali2014's full-sized avatar
💢
Depressed

Muhamad Ari Sawali arisawali2014

💢
Depressed
View GitHub Profile
@arisawali2014
arisawali2014 / dtTableToCsv.vb
Created June 5, 2020 06:27
VB.Net DataTable to CSV
Private Function dtTableToCSV(dt As DataTable, filename As String, Optional headers As Boolean = True, Optional delim As String = ",")
Dim txt As String
Dim fileloc As String = filename + ".csv"
If File.Exists(fileloc) Then
File.Delete(fileloc)
End If
Dim n = 0
If headers = True Then
For Each column As DataColumn In dt.Columns
If n = 0 Then
@arisawali2014
arisawali2014 / telegraph.php
Last active February 25, 2024 07:00
Upload Image to Telegraph with Curl
<?php
public function uploadMedia($file)
{
$target_url = "https://telegra.ph/upload";
$file_name_with_full_path = $file;
if (function_exists('curl_file_create')) { // php 5.5+
$cFile = curl_file_create($file_name_with_full_path);
} else { //
$cFile = '@' . realpath($file_name_with_full_path);