Skip to content

Instantly share code, notes, and snippets.

View paulspencerwilliams's full-sized avatar

Paul Williams paulspencerwilliams

View GitHub Profile
@paulspencerwilliams
paulspencerwilliams / ensure-all-there.clj
Created October 13, 2021 19:09
Simple ns that lists files that are in one folder but not another, or different in both
(ns ensure-all-there.core
(:use clojure.data)
(:require [clj-commons.digest :as digest]))
(def jpgs-path "/Users/will/Pictures/New photography workflow/1_ingest_and_cull/jpgs-from-lightroom")
(def originals-path "/Volumes/RAID/photography/originals")
(defn files-in [folder]
(->> folder
@paulspencerwilliams
paulspencerwilliams / docker-compose.yml
Created July 25, 2017 07:53
Can't access docker hosted Samba container from local Mac
samba:
image: dperson/samba
command: -u "example1;badpass" -s "media;/media;no;no;no;example1" -p
ports:
- "139:139"
- "445:445"
volumes:
- ~/bcam/samba/media:/media
- ~/bcam/samba/usershares:/var/lib/samba/usershares
@paulspencerwilliams
paulspencerwilliams / now.txt
Created October 27, 2017 07:59
Failure when attempting to deploy Egghead.io Redux course code to now.sh
> > redux-course@0.1.0 build /home/nowuser/src
> > react-scripts build
> Creating an optimized production build...
> Compiled successfully.
> File sizes after gzip:
> 57.9 KB build/static/js/main.73d14002.js
> 522 B build/static/css/main.6a72b013.css
> The project was built assuming it is hosted at the server root.
> To override this, specify the homepage in your package.json.
> For example, add this to build it for GitHub Pages:
@paulspencerwilliams
paulspencerwilliams / gist:7616944
Created November 23, 2013 16:48
Why do I get a "error: not found: type LineElement" when trying to load this scala file?
abstract class Element {
def contents: Array[String]
def height: Int = contents.length
def width: Int = if (height == 0) 0 else contents(0).length
def beside(that: Element): Element = {
new LineElement("hello")
}
}
class Activity < ActiveRecord::Base
def self.random_undone(amount_to_return)
Activity.where(:done => false).random(amount_to_return)
end
end
@paulspencerwilliams
paulspencerwilliams / gist:6146918
Created August 3, 2013 15:48
How to map user readable uppercase 'Attributes' for models in tabular Given steps with lowercase rails model attributes
Background:
Given the following set of activites exist
| Activity | Weather |
| Got to the Weston Super Mare | Sunny |
| Visit Sea Life Center | Raining |
| Visit West Midlands Safari Park | Sunny |
| Visit Madame Tussauds | Raining |
Scenario: Suggesting a set of sunny activities
When I state that Saturday's weather will be "Sunny"
@paulspencerwilliams
paulspencerwilliams / repo.sh
Created August 1, 2013 14:14
Script to reproduce Error when running with Rails4, Ruby2 - https://github.com/netzpirat/guard-cucumber/issues/42
#/usr/bin/env ruby
rails new BugReproduce -T
cd BugReproduce
echo "group :test do" >> Gemfile
echo " gem 'rspec-rails'" >> Gemfile
echo " gem 'cucumber-rails'" >> Gemfile
echo " gem 'database_cleaner'" >> Gemfile
echo "end" >> Gemfile
echo "group :development do" >> Gemfile
@paulspencerwilliams
paulspencerwilliams / gist:6131005
Created August 1, 2013 12:45
Output of guard running cucumber-rails and cucumber-rspec in newly created rails 4 project without minitest support by using -T on Rails new command.
13:44:23 - INFO - Guard is using Tmux to send notifications.
13:44:23 - INFO - Guard is using TerminalTitle to send notifications.
13:44:23 - INFO - Guard::RSpec is running
13:44:23 - INFO - Running all features
Disabling profiles...
DEPRECATION WARNING: ActionController::Integration is deprecated and will be removed, use ActionDispatch::Integration instead. (called from require at /Users/will/src/whatshallwedo/features/support/env.rb:7)
DEPRECATION WARNING: ActionController::IntegrationTest is deprecated and will be removed, use ActionDispatch::IntegrationTest instead. (called from require at /Users/will/src/whatshallwedo/features/support/env.rb:7)
0 scenarios
require 'rails_helper'
RSpec.describe ActivitiesController do
describe "GET index" do
it "assigns @activities" do
all_activities = double("all activities")
allow(Activity).to receive(:all) { all_activities }
get :index
expect(assigns(:activities)).to eq(all_activities)
end
Given Paul is a registered user
When I log in as Paul
Then I will see Paul's homepage