Skip to content

Instantly share code, notes, and snippets.

View bdaniel7's full-sized avatar

Daniel Blendea bdaniel7

  • Bucharest, Romania
View GitHub Profile
@ghosh
ghosh / micromodal.css
Last active July 1, 2025 17:27
Demo modal styles for micromodal.js and corresponding expected html. If using this, set the `awaitCloseAnimation` in config to true
/**************************\
Basic Modal Styles
\**************************/
.modal {
font-family: -apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif;
}
.modal__overlay {
position: fixed;
@ayende
ayende / LetsEncryptClient.cs
Created January 11, 2018 22:26
ACME v2 client for Let's Encrypt
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
namespace WebApplication1
{
public class Program
{
public static void Main(string[] args)

Strings

String.prototype.*

None of the string methods modify this – they always return fresh strings.

  • charAt(pos: number): string ES1

    Returns the character at index pos, as a string (JavaScript does not have a datatype for characters). str[i] is equivalent to str.charAt(i) and more concise (caveat: may not work on old engines).

// Do this in Startup. All calls to SimpleCast will use the same HttpClient instance.
FlurlHttp.ConfigureClient(Configuration["SimpleCastServiceUri"], cli => cli
.Configure(settings =>
{
// keeps logging & error handling out of SimpleCastClient
settings.BeforeCall = call => logger.LogWarning($"Calling {call.Request.RequestUri}");
settings.OnError = call => logger.LogError($"Call to SimpleCast failed: {call.Exception}");
})
// adds default headers to send with every call
.WithHeaders(new
@diegopacheco
diegopacheco / main.tf
Last active August 14, 2021 19:08
Terraform + Localstack
provider "aws" {
region = "us-west-2"
access_key = "anaccesskey"
secret_key = "asecretkey"
skip_credentials_validation = true
skip_metadata_api_check = true
s3_force_path_style = true
endpoints {
s3 = "http://119.18.0.101:4572"
}
import numpy as np, cv2, sys
import memcache
import time
sys.path.append('../../../')
from hsapi import ObjectDetector
from grovepi import *
from twilio.rest import Client
@MangelMaxime
MangelMaxime / fable-repl.css
Created June 27, 2019 13:51
Drag & Drop using Elmish and React hooks
html,
body {
font-size: 16px;
}
@changhuixu
changhuixu / ThrottledHttpClient.cs
Created September 18, 2019 02:22
.net core named httpclient, throttle rate, semaphore, semaphoreslim, task, async, asynchronous,
public class ThrottledHttpClient : IThrottledHttpClient
{
private readonly HttpClient _httpClient;
private readonly string _baseUrl = @"http://localhost:5000/api";
public ThrottledHttpClient(HttpClient httpClient)
{
_httpClient = httpClient;
}
@changhuixu
changhuixu / HttpClientInConsoleApp.cs
Created September 18, 2019 02:24
.net core console app httpclient dependency injection
private static async Task Main()
{
var services = new ServiceCollection().AddHttpClient();
services.AddHttpClient<IThrottledHttpClient, ThrottledHttpClient>();
var serviceProvider = services.BuildServiceProvider();
var client = serviceProvider.GetService<IThrottledHttpClient>();
var numbers = new List<long> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 11, 13, 17, 19, 23, 29, 31, 41, 43, 1763 };
var results = await client.GetPrimeNumberResults(numbers);
foreach (var result in results)