Skip to content

Instantly share code, notes, and snippets.

View whomwah's full-sized avatar

Duncan Robertson whomwah

View GitHub Profile
@whomwah
whomwah / Dockerfile
Last active April 11, 2019 08:19
[Legacy Ruby Docker] Simple Dockerfile that does legacy Ruby, for Rails Apps #docker
FROM ubuntu:16.04
MAINTAINER john@doe.com
ENV REFRESHED_AT 2016-07-27
# Choose your ruby version
ENV RUBY_VERSION 'ruby 2.2'
# Install packages
RUN apt-get update && apt-get -y install wget \
build-essential \
@whomwah
whomwah / Gemfile
Last active April 11, 2019 08:20
[Raspberry Pi] A simple bot in Ruby that uses RPi::GPIO to check a pin on a Raspberry PI with a moisture sensor on it to see if it needs watering. #pi
source 'https://rubygems.org'
gem 'rpi_gpio', '~> 0.3.3'
gem 'slack-ruby-client', '~> 0.10.0'
@whomwah
whomwah / docker.md
Last active June 19, 2019 09:43
[Docker] useful commands #docker

Execute an interactive bash shell on the container

docker exec -it app-accounting bash

Remove unused volumes

$ docker volume rm (docker volume ls -q -f dangling=true)

Remove all images

@whomwah
whomwah / README.md
Created April 11, 2019 08:26
[Swift] #swift

To observer any notification

center.addObserver(forName: nil, object: nil, queue: nil) { (note) in
  print("note: \(note)")
}
@whomwah
whomwah / README.md
Created October 7, 2019 08:23
[Semantic Commit Messages] #git
@whomwah
whomwah / README.md
Created January 29, 2020 09:57
[TMUX] #tmux

Start new session with name

tmux new -s mysession

Attach to existing session

tmux a -t mysession

Attach to last session

tmux a

List sessions

@whomwah
whomwah / README.md
Last active February 7, 2020 16:14
[JS Testing] #js

Helpful JS testing tips

JEST Mocking

Spotify.validateTrack.mockImplementation(trackMock)
Decorator.parse.mockResolvedValue('unifiedMessage')
User.findOneAndUpdate.mockRejectedValue(new Error('bang'))
@whomwah
whomwah / server.tsx
Last active November 11, 2022 23:47
Deno / React example
// @deno-types="https://deno.land/x/types/react/v16.13.1/react.d.ts"
import React from "https://dev.jspm.io/react@16.13.1";
// @deno-types="https://deno.land/x/types/react-dom/v16.13.1/server.d.ts"
import ReactDOMServer from "https://dev.jspm.io/react-dom@16.13.1/server";
import { opine } from "https://deno.land/x/opine@0.3.0/mod.ts"
export {
Request,
Response,
NextFunction,
} from "https://deno.land/x/opine@0.3.0/src/types.ts";