Skip to content

Instantly share code, notes, and snippets.

View nyinyithann's full-sized avatar
🎩

Nyi Nyi nyinyithann

🎩
View GitHub Profile
@nyinyithann
nyinyithann / async_download_with_thread_pool.rs
Created March 11, 2019 07:32
Async Download with ThreadPool
#![feature(result_map_or_else)]
extern crate num_cpus;
extern crate reqwest;
extern crate threadpool;
use std::error::Error;
use std::thread;
use threadpool::ThreadPool;
@nyinyithann
nyinyithann / DataTableToExpandoObjects.cs
Created November 22, 2019 02:39
DataTable To ExpandoObjects C#
public static class DataTableExtensions
{
public static IEnumerable<dynamic> ToExpandoObjectList(this DataTable self)
{
var result = new List<dynamic>(self.Rows.Count);
foreach (var row in self.Rows.OfType<DataRow>())
{
var expando = new ExpandoObject() as IDictionary<string, object>;
foreach (var col in row.Table.Columns.OfType<DataColumn>())
{
@nyinyithann
nyinyithann / gist:072077a9ab67f62c4df2ae6e2728a74f
Created January 20, 2022 16:14
TailwindColor Hex Value to RGB
const tailwindColors = {
foo: {
50: '#f9fafb',
100: '#f3f4f6',
200: '#e5e7eb',
300: '#d1d5db',
400: '#9ca3af',
500: '#6b7280',
600: '#4b5563',
700: '#374151',
@nyinyithann
nyinyithann / gadt.res
Created November 26, 2022 19:56
GADT ReScript
%%raw(
"/*
* this js function will work under both [string] and [float]
*/
function add (x,y){
return x + y;
}")
type rec t<_> = | String : t<string> | Float : t<float>