Skip to content

Instantly share code, notes, and snippets.

Avatar

Demis Bellot mythz

View GitHub Profile
@mythz
mythz / vanilla.js
Last active Mar 4, 2021
3 missing JS functions
View vanilla.js
let $ = (sel, el) => typeof sel === "string" ? (el || document).querySelector(sel) : sel || null,
$$ = (sel, el) => Array.prototype.slice.call((el || document).querySelectorAll(sel));
function on(sel, handlers) {
$$(sel).forEach(e => {
Object.keys(handlers).forEach(function (evt) {
let fn = handlers[evt];
if (typeof evt === 'string' && typeof fn === 'function') {
e.addEventListener(evt, fn.bind(e));
}
View keybase.md

Keybase proof

I hereby claim:

  • I am mythz on github.
  • I am mythz (https://keybase.io/mythz) on keybase.
  • I have a public key ASAeJidstT7bc7YfiJpDh_XTzcEFOsssBSa-CfwM_aQJlwo

To claim this, I am signing this object:

@mythz
mythz / basic-fsharp-gtk-demo.fs
Created Sep 15, 2011
Basic F# demo using Mono Gtk#
View basic-fsharp-gtk-demo.fs
let btnUp = new Button("Increment", Visible=true)
let btnDown = new Button("Decrement", Visible=true)
let lbl = new Label(Text=" Count: 0", Visible=true)
Event.merge
(btnUp.Clicked |> Event.map (fun _ -> +1))
(btnDown.Clicked |> Event.map (fun _ -> -1))
|> Event.scan (+) 0
|> Event.map (sprintf " Count: %d")
|> Event.add (fun s -> lbl.Text <- s)
@mythz
mythz / IServiceClient.cs
Created Jul 6, 2015
Combined IServiceClient Interfaces
View IServiceClient.cs
namespace ServiceStack
{
public interface IServiceClient : IServiceClientAsync, IOneWayClient, IRestClient, IReplyClient, IHasSessionId, IHasVersion
{
int Version { get; set; } //IHasVersion
string SessionId { get; set; } //IHasSessionId
//IReplyClient:
TResponse Send<TResponse>(object request);
TResponse Send<TResponse>(IReturn<TResponse> request);
@mythz
mythz / main.cs
Last active Dec 2, 2020
Custom SQL Issue
View main.cs
using System;
using System.Linq;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.DataAnnotations;
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);
var db = dbFactory.Open(); // Open ADO.NET DB Connection
@mythz
mythz / main.cs
Last active Nov 23, 2020
Ensures with Dynamic SqlExpression Example
View main.cs
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.DataAnnotations;
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);
var db = dbFactory.Open(); // Open ADO.NET DB Connection
OrmLiteUtils.PrintSql(); // view generated SQL
OrmLiteConfig.StripUpperInLike = true; // comment to force insensitive like comparisons
@mythz
mythz / main.cs
Created Oct 19, 2020
Create new JWT Auth Key
View main.cs
var base64Key = System.Convert.ToBase64String(ServiceStack.AesUtils.CreateKey());
System.Console.WriteLine(base64Key);
@mythz
mythz / main.cs
Created Jul 1, 2020 — forked from alfredoPacheco/main.cs
Redis Redis/Memory RemoveAll repro
View main.cs
using System;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.Redis;
using ServiceStack.DataAnnotations;
using ServiceStack.Caching;
var redisManager = new RedisManagerPool("localhost:6379");
var redis = redisManager.GetClient();
redis.FlushAll();
@mythz
mythz / main.cs
Last active Jun 29, 2020
Redis RemoveAll repro
View main.cs
using System;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.Redis;
using ServiceStack.DataAnnotations;
var redisManager = new RedisManagerPool("localhost:6379");
var redis = redisManager.GetClient();
redis.FlushAll();