Skip to content

Instantly share code, notes, and snippets.

@b01
b01 / download-vs-code-server.sh
Last active June 6, 2024 13:15
Linux script to download latest VS Code Server, good for Docker (tested in Alpine).
#!/bin/sh
# Copyright 2023 Khalifah K. Shabazz
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the “Software”),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
@noamtamim
noamtamim / README.md
Last active July 9, 2024 08:45
Markdown with PlantUML

How to use PlantUML with Markdown

PlantUML is a really awesome way to create diagrams by writing code instead of drawing and dragging visual elements. Markdown is a really nice documentation tool.

Here's how I combine the two, to create docs with embedded diagrams.

Step 0: Setup

Get the command-line PlantUML from the download page or your relevant package manager.

@a-voronov
a-voronov / pretty-description.swift
Created May 2, 2019 16:15
Pretty Swift.Any description
func prettyDescription(of subject: Any, indentCoeff: Int = 0) -> String {
let mirror = Mirror(reflecting: subject)
let properties = mirror.children
guard let displayStyle = mirror.displayStyle else {
return String(reflecting: subject)
}
let indent = "\t"
let globalIndent = String(repeating: indent, count: indentCoeff)
@firasd
firasd / functions.php
Created May 24, 2018 21:52
Remove 'Mark Complete' button from lesson pages in Learndash course
<?php
add_filter('learndash_mark_complete', function($return, $post) {
$course_hide_markcomplete = 0;
if(learndash_get_course_id($post->ID) == $course_hide_markcomplete) {
$return = '';
}
return $return;
}, 10, 2);
@DougGregor
DougGregor / dynamic_member_lookup_environment.swift
Created May 2, 2018 16:59
Using Swift 4.2's @dynamicMemberLookup to expose environment variables
import Darwin
@dynamicMemberLookup
struct Environment {
subscript(dynamicMember name: String) -> String? {
get {
guard let value = getenv(name) else { return nil }
return String(validatingUTF8: value)
}
@lattner
lattner / TaskConcurrencyManifesto.md
Last active July 21, 2024 05:08
Swift Concurrency Manifesto
@marcan
marcan / bloom.py
Last active February 29, 2024 19:55
Simple Bloom filter implementation in Python 3 (for use with the HIBP password list)
#!/usr/bin/python3
#
# Simple Bloom filter implementation in Python 3
# Copyright 2017 Hector Martin "marcan" <marcan@marcan.st>
# Licensed under the terms of the MIT license
#
# Written to be used with the Have I been pwned? password list:
# https://haveibeenpwned.com/passwords
#
# Download the pre-computed filter here (968MB, k=11, false positive p=0.0005):
@JohnSundell
JohnSundell / WrappingSingletons.swift
Last active October 26, 2017 18:23
This is a great technique if you need to interact with singleton-based APIs but still have great testability
import UIKit
// Create a protocol that defines what APIs that you need from the singleton
protocol Application {
func open(url: URL)
}
// Make the singleton-based class conform to your protocol
extension UIApplication: Application {
func open(url: URL) {
@fpillet
fpillet / MeasurePerf.swift
Last active June 26, 2019 12:51
A tool to measure code performance in Swift
//
// Created by Florent Pillet on 14/11/16.
// Copyright (c) 2016 Florent Pillet. All rights reserved.
//
import Foundation
/*
* A utility struct that helps mesure the performance of sections of code. Only uses Foundation
* (we could also use QuartzCore's CACurrentMediaTime() for similar precision)
@leonardofed
leonardofed / README.md
Last active July 19, 2024 17:51
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.