Skip to content

Instantly share code, notes, and snippets.

View chkob's full-sized avatar
😅
I may be slow to respond.

Chatchai Daecha chkob

😅
I may be slow to respond.
  • Bangkok, Thailand
View GitHub Profile
@chkob
chkob / gist:9465c05b37e1356575959e82571ae09c
Created December 20, 2019 07:11
reading list 2019-12-20
https://help.github.com/en/github/managing-packages-with-github-packages/about-github-packages#supported-clients-and-formats
https://hillside.net/patterns/patterns-catalog
@chkob
chkob / add_a_chain_of_services_through_di.txt
Created December 16, 2019 06:13
add a chain of services...
// I also forgot where I'd copied from, probably from some thread of StackOverflow
public interface IService
{
string Description { get; }
}
public class ServiceA : IService
{
public string Description { get; set; } = "I am Service A, created through DI";
@chkob
chkob / add_nhibernate_as_service.txt
Created December 16, 2019 06:10
Adding nhibernate as services for .net
// copy from somewhere from internet which I lost the source....
public static class NHibernateExtensions
{
public static IServiceCollection AddNHibernate(this IServiceCollection services, string connectionString)
{
var mapper = new ModelMapper();
mapper.AddMappings(typeof(NHibernateExtensions).Assembly.ExportedTypes);
HbmMapping domainMapping = mapper.CompileMappingForAllExplicitlyAddedEntities();
@chkob
chkob / load_icons.ps1
Created November 2, 2019 13:58
load images from urls
#$urlArray = @() # paste array of url
$files = @()
foreach($path in $urlArray)
{
$file = Split-Path $path -leaf
$tuppleFile = @($file, $path)
$files += $tuppleFile
}
Write-Output $files.Count
@chkob
chkob / get-image-urls.js
Last active November 2, 2019 12:47 — forked from tobek/get-image-urls.js
Save images from chrome inspector/dev tools network tab
/* open up chrome dev tools (Menu > More tools > Developer tools)
* go to network tab, refresh the page, wait for images to load (on some sites you may have to scroll down to the images for them to start loading)
* right click/ctrl click on any entry in the network log, select Copy > Copy All as HAR
* open up JS console and enter: var har = [paste]
* (pasting could take a while if there's a lot of requests)
* paste the following JS code into the console
* copy the output, paste into a text file
* open up a terminal in same directory as text file, then: wget -i [that file]
*/
@chkob
chkob / springer-free-maths-books.md
Created November 8, 2018 06:51 — forked from bishboria/springer-free-maths-books.md
Springer made a bunch of books available for free, these were the direct links