Skip to content

Instantly share code, notes, and snippets.

View peterjwest's full-sized avatar

Peter West peterjwest

View GitHub Profile
@peterjwest
peterjwest / wishlist.md
Last active December 19, 2023 10:17
Wishlist
@peterjwest
peterjwest / ducky7
Last active July 8, 2023 10:47
Artic phone
AQAAAAMAAAAAAAAAAgACAAMAogCbAJMAAwCiAJsAkwABAAUAAQAFAAAAWQAAAIJu1XMCAIJu1XMCAIJuGnQCAKhuXnQCAM5u53QCABtvtHUCAI5vxnYCAE1wYHgCADNxP3oCAItyMH0CAFZ07oACACJ2rIQCAIZ4e4kCAN55bIwCADd7044CAGl8spACACh9xJECAMF91pICADR+o5MCAIF+cJQCAPR++ZQCAEB/gpUCAGZ/xpUCAI1/T5YCALN/T5YCANl/lJYCAP9/2JYCACaAHJcCAEyAHJcCAHKAHJcCAJmAYZcCAL+AYZcCAOWApZcCAAuB6pcCADKBc5gCAFiBQJkCAH6ByZkCAMuBDZoCAPGBlpoCAD6C2poCAGSCH5sCAIqCH5sCANeCH5sCAP2CH5sCAEmDH5sCALyDH5sCAAmE2poCAHyElpoCAMiEUZoCADuFDZoCAK6FyZkCAEeGhJkCALqGhJkCAFOHQJkCABKI+5gCAF+I+5gCAKuIt5gCANGIt5gCANGIc5gCANGILpgCAKuILpgCAIWILpgCADiI6pcCAOyH6pcCAMaH6pcCAHmHpZcCAFOHpZcCAAaHYZcCAOCGYZcCALqGYZcCAJOGHJcCAG2GHJcCACGGHJcCANSF2JYCAGGF2JYCABWF2JYCAKKE2JYCAFWElJYCAAmElJYCAOODlJYCAOOD2JYCAOODHJcCAAmEHJcCAAmEYZcCAAmEpZcCAAmE6pcCAAmELpgCAOODLpgBAOODLpgEAAMAsACEAEAAAwCwAIQAQAAAADQAAADBYH9yAgDBYH9yAgDnYH9yAgANYX9yAgANYTtyAgA0YTtyAgBaYfZxAgCAYfZxAgDNYbJxAgDzYW1xAgBAYilxAgBmYilxAgCMYuVwAgCyYuVwAgD/YqBwAgAlY1xwAgBLYxdwAgCYYxdwAgC+Y9NvAgDlY49vAgALZEpvAgAxZEpvAgBXZAZvAgB+ZMFuAgDKZH1uAgDwZDhuAgAXZThuAgA9ZfRt
@peterjwest
peterjwest / example1.md
Last active June 17, 2020 13:09
Functional function examples

The goal in this example is to count the number of books each author has written, from a list of book objects.

Example input:

const books = [
    { author: "Jane", name: "Foo: a bar" },
    { author: "John", name: "Tale of Zim" },
    { author: "Jan", name: "Legend of Gir"  },
    { author: "Jane", name: "Zig 2: the sequel" },
@peterjwest
peterjwest / large-dataset.json
Last active October 3, 2017 10:29
Assignment dataset
{
"/slf4j-logkit/org/slf4j/implStaticLoggerBinder.java": {
"coveredLines": 7,
"totalLines": 78
},
"/slf4j-logkit/org/apache/jmeter/loggingLogkitLoggerAdapter.java": {
"coveredLines": 137,
"totalLines": 327
},
"/slf4j-logkit/org/apache/jmeter/loggingLogkitLoggerFactory.java": {
@peterjwest
peterjwest / test.js
Created April 21, 2017 17:07
Mocha timeouts
var assert = require('assert');
describe('Synchronous timeout', () => {
beforeEach(() => {
var x = Date.now();
while (Date.now() < x + 2100) {}
});
it('Tests nothing', () => assert.equal(1, 1));
});
@peterjwest
peterjwest / README.md
Last active August 29, 2015 14:23
Prototype template

Prototype for a Perch-inspired CMS template.

  • Tags based on handlebars, using JS syntax for arguments
  • Four tags:
    • block - defines a named section in the CMS
    • repeat - allows items to repeated; can set min, max or exact number of repetitions
    • content - defines a piece of content, same kind of configuration as Perch, sensible defaults based on where the tag is used (i.e. text in a <p>, URL in a href, text in an alt),
    • template - loads another file as a template, templates can contain any of the four tags

Thinking about something like: {{ template('shared/content', {shared: true}) }} to allow templates to be shared across different pages.

@peterjwest
peterjwest / git-cleanup.sh
Last active July 7, 2023 15:42
Git aliases
#!/usr/bin/env bash
set -euo pipefail
for BRANCH in $(git branch | grep -E -v "^(\* | (develop|master|main)$)"); do
if [[ -z $(git --no-pager log develop..$BRANCH --author=$(git config user.email)) ]]; then
git branch -D $BRANCH
fi
done
@peterjwest
peterjwest / purge.sh
Created February 3, 2015 10:25
Delete .DS_Store files
sudo find / -name ".DS_Store" -depth -exec rm {} \;
@peterjwest
peterjwest / selector.css
Created January 28, 2015 13:29
The longest CSS selector I've ever seen
html .cmsms_color_scheme_fourth h1,
html .cmsms_color_scheme_fourth h2,
html .cmsms_color_scheme_fourth h3,
html .cmsms_color_scheme_fourth h4,
html .cmsms_color_scheme_fourth h5,
html .cmsms_color_scheme_fourth h6,
html .cmsms_color_scheme_fourth h1 a,
html .cmsms_color_scheme_fourth h2 a,
html .cmsms_color_scheme_fourth h3 a,
html .cmsms_color_scheme_fourth h4 a,
@peterjwest
peterjwest / dna.py
Created August 6, 2014 09:51
DNA python
from __future__ import division
print '\nExample 1'
# Input DNA 1
dna = "ACTGATCGATTACGTATAGTATTTGCTATCATACATATATATCGATGCGTTCAT"
print 'DNA:', dna
# Calculate AT count
A_count = dna.count("A")