Skip to content

Instantly share code, notes, and snippets.

@Sharpiro
Sharpiro / index.ts
Created February 24, 2020 03:37
decorator validation
function Validate<T extends { new(...args: any[]): {} }>(constructor: T) {
return class extends constructor {
errors: string[]
constructor(...items: any[]) {
super(...items)
this.errors = []
for (const x in this) {
if (this[x] == undefined) {
this.errors.push(`property '${x}' was undefined on class '${constructor.name}'`)
@Sharpiro
Sharpiro / img_viewer.html
Last active August 23, 2019 19:44
static image viewer
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta property="og:image" content="" />
<meta property="og:title" content="Image Viewer" />
<meta property="og:description" content="" />
@Sharpiro
Sharpiro / main.py
Created August 17, 2019 18:42
http request
import socket
# https://93.184.216.34/ # example.com
# http://52.239.152.74/tor-blobs/tor.txt # http://torpy.blob.core.windows.net/tor-blobs/tor.txt
# # example.com
# ip_address = "93.184.216.34"
# port = 80
# host = "example.com"
# path = "/"
using System;
namespace ConsoleApp1
{
internal class Program
{
private static void Main(string[] args)
{
var stringData = "hello Steve";
var dangerousSpan = stringData.AsSpan();