Skip to content

Instantly share code, notes, and snippets.

@chranderson
chranderson / nvmCommands.js
Last active December 25, 2024 16:26
Useful NVM commands
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node
@Nitrousoxide
Nitrousoxide / readme.md
Last active December 25, 2024 16:22
Tree Style Tabs
@mishterk
mishterk / custom-wordpress-menu-items-template.php
Last active December 25, 2024 16:19
How to render WordPress menu items without a custom walker
<?php $menu_location = 'some_menu_location'; ?>
<?php if ( has_nav_menu( $menu_location ) ): ?>
<?php $menu_items = wp_get_nav_menu_items( wp_get_nav_menu_name( $menu_location ) ); ?>
<?php foreach ( $menu_items as $menu_item ): ?>
<a href="<?= esc_url( $menu_item->url ) ?>"
target="<?= esc_attr( $menu_item->target ?: '_self' ) ?>"
@miyukino
miyukino / MergeSort.scm
Created May 26, 2013 08:41
Scheme: Merge Sort
;; Exp. (merge '(1 3 5 7 8 9 10) '(2 4 6)) ==> (1 2 3 4 5 6 7 8 9 10)
(define (merge L M)
(if (null? L) M
(if (null? M) L
(if (< (car L) (car M))
(cons (car L) (merge (cdr L) M))
(cons (car M) (merge (cdr M) L))))))
;; split helper functions
(define (odd L)

It can be difficult to test the different scenarious for a module intended for use by including in another class.

If the class is statically defined in the spec, any later definitions extend, not replace, the first definition - which can cause test issues and breaks isolation between examples.

RSpec.describe SomeModule do
  class SomeIncluder
    include SomeModule
  end
 
@adammyhre
adammyhre / Closure.cs
Created December 22, 2024 08:44
Simple Closure Implementation for Unity C#
using System;
public struct Closure<TContext> {
Delegate del;
TContext context;
public Closure(Delegate del, TContext context = default) {
this.del = del;
this.context = context;
}
Linkedin = {
config: {
scrollDelay: 3000,
actionDelay: 5000,
nextPageDelay: 5000,
// set to -1 for no limit
maxRequests: -1,
totalRequestsSent: 0,
// set to false to skip adding note in invites
addNote: true,
@bagder
bagder / urlgen.pl
Last active December 25, 2024 16:08
perl script to generate URL variations for URL parser tests and benchmarks
#!/usr/bin/perl
# [scheme][divider][userinfo][hostname][port number][path][query][fragment]
my $num = $ARGV[0];
sub get_part
{
my ($part, $g) = @_;
my @a;
@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active December 25, 2024 16:02
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@basyliq
basyliq / gohugo_bsky_comments.md
Last active December 25, 2024 16:01
Integrate Bluesky replies as your blog's comment section in gohugo.io framework

Layout: layouts/_default/single.html

<div id="comments-section" data-bsky-uri="{{ .Params.bsky }}"></div>
{{ $comments := resources.Get "js/comments.js" }}
<script src="{{ $comments.RelPermalink }}"></script>