Skip to content

Instantly share code, notes, and snippets.

View StevenBlack's full-sized avatar
🇨🇦

Steven Black StevenBlack

🇨🇦
View GitHub Profile
@StevenBlack
StevenBlack / elapsed.rs
Created January 25, 2022 05:50
Rust elapsed time
use std::time::Instant;
let start = Instant::now();
let mut lines: Vec<String> = self.raw_list.clone();
println!("clone {}", start.elapsed().as_millis());
@StevenBlack
StevenBlack / named_colors.sql
Last active January 17, 2022 17:12
Several hundred named colors with hex codes.
-- collected from various sources on the web.
select * from (
('Absolute zero','#0048BA'),
('Acid green','#B0BF1A'),
('Aero','#7CB9E8'),
('Aero blue','#C9FFE5'),
('African violet','#B284BE'),
('Air Force blue (RAF)','#5D8AA8'),
('Air Force blue (USAF)','#00308F'),
@StevenBlack
StevenBlack / 1-setup.md
Created November 16, 2021 21:05 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS Sierra/High Sierra

Methods of Signing with GPG

Last updated March 28, 2021

There are now two ways to approach this:

  1. Using gpg and generating keys
  2. Using Kryptonite by krypt.co

This Gist explains how to do this using gpg in a step-by-step fashion. Kryptonite is actually wickedly easy to use-but you will still need to follow the instructions

@StevenBlack
StevenBlack / semantic-commit-messages.md
Created September 27, 2021 14:41 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@StevenBlack
StevenBlack / trycatch.go
Created April 30, 2021 15:01
Go Try/Catch/Finally implementation
// source: https://play.golang.org/p/LXroobH8SM
package main
import (
"fmt"
)
type Block struct {
Try func()
Catch func(Exception)
@StevenBlack
StevenBlack / empty_rust_structs.md
Last active October 17, 2020 01:06 — forked from ChrisWellsWood/empty_rust_structs.md
Initialising empty structs in Rust.

Initializing Empty Structs in Rust

In C/C++, you can initialise a struct without giving values for any of the fields:

struct Point {
  float x;
  float y;
  float z;
};
/*
COLORS
Better default colors for the web
*/
/*
VARIABLES
@StevenBlack
StevenBlack / GA-Events.js
Last active September 27, 2019 09:20
Google Analytics Events Example
// Upon document ready, have jQuery do the following
$( function(){
var gaJsHost = ( ( "https:" === document.location.protocol ) ? "https://ssl." : "http://www." );
// use jQuery to call the Google Analytics JavaScript
$.getScript( gaJsHost + "google-analytics.com/ga.js", function(){
// tell Analytics about the current page load using standard _trackPageview method
try {
var pageTracker = _gat._getTracker( $.mcm.apiKeys.analytics );
// the standard page tracking code
pageTracker._trackPageview();
@StevenBlack
StevenBlack / jquery.pluginOutline.js
Created April 6, 2010 22:41
Skeleton jQuery plugin
// Skeleton jQuery plugin
function($)
{
$.fn.myPlugin = function( options )
{
// options.
$.fn.myPlugin.settings = $.extend( {}, $.fn.myPlugin.defaults, options );
// Go through the matched elements and return the jQuery object.
@StevenBlack
StevenBlack / pg_change_db_owner.sh
Created April 8, 2018 21:19 — forked from jirutka/pg_change_db_owner.sh
Some convenient scripts to manage ownerships and privileges in PostgreSQL.
#!/bin/sh
#
# The MIT License
#
# Copyright 2014-2017 Jakub Jirutka <jakub@jirutka.cz>.
#
# 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