Skip to content

Instantly share code, notes, and snippets.

@JakeLane
JakeLane / to-slack-emoji.sh
Last active April 10, 2019 06:23
To Slack Emoji
echo "letter" | tr '[:upper:]' '[:lower:]' | sed -e "s/\([a-z]\)/:letter-\1:/g"
echo "comic sans" | tr '[:upper:]' '[:lower:]' | sed -e "s/\([a-z]\)/:comicsans-\1:/g"
echo "fancy" | tr '[:upper:]' '[:lower:]' | sed -e "s/\([a-z]\)/:fancy-\1:/g"
echo "regional" | tr '[:upper:]' '[:lower:]' | sed -e "s/\([a-z]\)/:regional_indicator_\1:/g"
@JakeLane
JakeLane / .editorconfig
Created January 16, 2019 23:06
.editorconfig for ShipIt 2019
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
@JakeLane
JakeLane / Makefile
Last active October 26, 2018 23:20
Automatic Makefile
# The compiler to use
CC = g++
# The compiler flags to use
CPPFLAGS = -pedantic -Wall -O2 -g -std=c++11
# the name of the outputed executable binary
EXENAME = main
# the directory to output objects to. (use . for current dir)
OUTDIR = .
@JakeLane
JakeLane / script.js
Created September 25, 2018 01:44
Open in Library Bookmarklet
const newHostname = window.location.hostname.replace(/\./g, "-");
const newUrl = `${window.location.protocol}//${newHostname}.proxy.library.adelaide.edu.au${window.location.port}${window.location.pathname}${window.location.search}${window.location.hash}`;
window.location = newUrl;
04fa11109e59b544692473cdb500f74d1b47f7e92b98e263438738d1926069003c622726d7b8f9fea7ef844cdb03e73149aefdce20a3664425e930a43db642c9d0
@JakeLane
JakeLane / quicksort.cpp
Created May 26, 2016 13:05
Basic Quicksort implementation
/**
* Jake Lane <me@jakelane.me>
*
* Basic Quicksort implementation
*/
#include <vector>
#include <iostream>
#include <algorithm>
#include <sstream>
@JakeLane
JakeLane / callback.js
Last active November 9, 2015 04:33
An example of an Asynchronous function with a callback
// A asynchronous function that has a string and a callback parameter
function asynchronousFunction(text, callback) {
console.log("The asynchronous function has been called and is about to callback");
// Run the callback function (from the parameters)
callback(text);
}
console.log("The asynchronous function is about to be called");
// This is a call to the asynchronous function (note that the function is the second parameter)
@JakeLane
JakeLane / Helpers.hpp
Created October 17, 2015 04:37
Basic C++ Helper library
// Helper Library header
// Author: Jake Lane
#ifndef HELPERS_H_
#define HELPERS_H_
class Helpers {
public:
// Helper function to convert int to string
template <typename T>
@JakeLane
JakeLane / tests.json
Last active October 16, 2015 15:10
External binary testing script
{
"tests": [
{
"description": "Description of test case",
"input": "Input",
"expectedout": "Expected output (compared to actual output)"
},
{
"description": "Test with different directory (runs binary inside the folder)",
"directory": "tests/test4",
@JakeLane
JakeLane / array_size
Created June 28, 2015 09:45
Find the number of elements in a C-style array
template <typename T, std::size_t N>
std::size_t size(T const (&)[N]) {
return N;
}