Skip to content

Instantly share code, notes, and snippets.

Alex alexjohnj

Block or report user

Report or block alexjohnj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alexjohnj
alexjohnj / BannerView.swift
Last active Dec 6, 2017
A UIView subclass that animates a banner down from the top of the screen (iOS 11+, Supports iPhone X)
View BannerView.swift
// swiftlint:disable file_length
//
// Created by Alex Jackson on 05/12/2017.
//
//Copyright 2017 Alex Jackson
//
//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
View keybase.md

Keybase proof

I hereby claim:

  • I am alexjohnj on github.
  • I am alexjohnj (https://keybase.io/alexjohnj) on keybase.
  • I have a public key ASAABAhSnp1HcvLjWxFiTYJxwMY27AfbSw-jYJq0ddlOrQo

To claim this, I am signing this object:

@alexjohnj
alexjohnj / Makefile
Created May 16, 2016
A generic Makefile template for somewhat complicated LaTeX documents.
View Makefile
# This is a generic Makefile that can be used to compile somewhat complicated
# LaTeX documents. It assumes a directory structure like this
# .
# ├── figures/*.{pdf,tex}
# ├── MAIN.tex
# ├── Makefile
# ├── Preamble.tex
# ├── sections/*.tex
# └── latex.out/
# and that you want to use a LaTeX runner such as latexrun or latexmk. The
@alexjohnj
alexjohnj / finddelta.jl
Last active Feb 16, 2016
Julia script to calculate length and azimuthal angles of a great circle joining two points on the Earth (ideally for seismology).
View finddelta.jl
#!/usr/bin/env julia
#
# A script used to find the length of the great circle joining two points on the
# Earth as well as the azimuth and back-azimuth of the great circle.
#
# USAGE: finddelta LAT1 LONG1 LAT2 LONG2
# OUTPUT: Absolute distance, angular distance, eq azimuth and back azimuth
# EXAMPLE (Great circle between the poles): finddelta -90 0 90 0
const EARTH_RADIUS = 6371_000
@alexjohnj
alexjohnj / vici.go
Created Apr 19, 2014
A program that performs a very basic frequency analysis on a string encrypted with a Caesar cipher.
View vici.go
// vici performs a very basic frequency analysis on a string of text encrypted with a Caesar cipher.
// It will output all possible keys and plaintexts for the ciphertext, with the most likely key/plaintext first and the least likely last
// Usage: vici [ciphertext]
// **NOTE** You'll need to run `go get github.com/alexjohnj/caesar` to build this program
// **NOTE 2** Since this outputs 26 lines of text to the console, you might want to redirect the output to a file.
package main
import (
"bytes"
"fmt"
@alexjohnj
alexjohnj / _deploy.py
Last active Feb 27, 2016
A deployment script I use to push my Jekyll blog onto Amazon S3. It compiles sass files, generates the site, gzips HTML, CSS & JavaScript and then uploads the site to Amazon S3 using s3cmd.
View _deploy.py
#! /usr/local/bin/python3
""" Requirements: s3cmd, jekyll, gzip & sass.
Mk 2 of the script
To use this script, you'll need to edit your site's _config.yml file and add the following:
s3bucket: s3://bucket-name
Remember: Change the path_to_sass_file & sass_compile_path variables if you want to compile sass files. If you don't want to compile sass files, comment out the call to the compile_sass() function.
You can’t perform that action at this time.