Skip to content

Instantly share code, notes, and snippets.

View j1n3l0's full-sized avatar

Nelo Onyiah j1n3l0

  • Goznel Limited
  • Kent UK
  • 08:39 (UTC -12:00)
View GitHub Profile
@j1n3l0
j1n3l0 / scratch-ts-project.bash
Last active March 19, 2024 23:37
Set up a new development typescript project
#!/bin/bash
set -euxo pipefail
git init
npm init -y
npm install -D depcheck eslint eslint-config-prettier eslint-plugin-jsdoc eslint-plugin-json eslint-plugin-prettier husky lint-staged prettier
npm pkg set scripts.depcheck='depcheck'
npm pkg set scripts.lint-staged='lint-staged --allow-empty'
@j1n3l0
j1n3l0 / override-isa.t
Created August 19, 2020 10:58
Override the response to ->isa fot Test2 mock objects
use Test2::V0;
subtest 'Overriding "isa" on a mock object' => sub {
isa_ok(
mock( {}, override => [ isa => sub { pop eq 'Foo' } ] ),
['Foo'],
'should correctly respond to "isa"',
);
};
@rougier
rougier / clean.el
Created May 10, 2020 02:43
A very minimal but elegant emacs configuration file
(require 'org)
(setq-default indent-tabs-mode nil)
(setq org-display-inline-images t)
(setq org-redisplay-inline-images t)
(setq org-startup-with-inline-images "inlineimages")
(setq default-frame-alist
(append (list '(width . 72) '(height . 40))))
# shellcheck shell=sh
nodenv() {
if has nodenv; then
export NODENV_VERSION="${1}"
else
echo "direnv: nodenv is not installed"
fi
}
use Test2::V0;
use Moo;
{
package Person;
use Moo;
has age => ( is => 'ro' );
}
{
@davidmason
davidmason / install-watchman.bash
Created September 13, 2017 03:45
To install watchman on Fedora 26, these are all the hoops I had to jump through.
# The following packages are needed during `make`
# - openssl-devel so you don't get:
# ContentHash.cpp:13:10: fatal error: openssl/sha.h: No such file or directory
# - redhat-rpm-config so you don't get:
# gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
# - python-devel so you don't get:
# pywatchman/bser.c:31:10: fatal error: Python.h: No such file or directory
sudo dnf install openssl-devel redhat-rpm-config python-devel
# The rest is just instructions from
@abstractart
abstractart / books.md
Last active May 26, 2025 16:54
Free Programming Ebooks - O'Reilly Media. Codeship free ebooks here - https://bit.ly/2oQ0knQ
dd if=~/Downloads/ubuntu-15.10-desktop-amd64.iso of=/dev/sdb && sync
@davegurnell
davegurnell / TypeclassDemo.scala
Created October 6, 2015 14:53
Example of the type class pattern in Scala
object TypeclasseDemo {
// The parts of the type class pattern are:
//
// 1. the "type class" itself -- a trait with a single type parameter;
//
// 2. type class "instances" for each type we care about,
// each marked with the `implicit` keyword;
//
// 3. an "interface" to the type class -- one or more methods
@davegurnell
davegurnell / anorm.scala
Last active April 10, 2025 06:37
A short guide to Anorm
/*
Overview
--------
To run a query using anorm you need to do three things:
1. Connect to the database (with or without a transaction)
2. Create an instance of `anorm.SqlQuery` using the `SQL` string interpolator
3. Call one of the methods on `SqlQuery` to actually run the query