Giter Club home page Giter Club logo

code-comparer-for-dummies's Introduction

clipcomp

It's me, I'm the dummy.

I wrote this program because I like to follow tutorials without copying and pasting. I think typing everything helps me remember what I learn. However, I frequently make transcription errors, realize that copying the tutorial code fixes my problem, and then stare at my code for a really long time trying to figure out where I mistyped.

I thought I'd write a program to make it explicitly clear to myself exactly where my file deviates from the contents of my clipboard because it might save me some time. Then I thought I'd write it in Java because I hate myself.

Requirements

Something to execute a Java archive with. I suggest OpenJDK.

Instructions

Easy method

Download a release. There's one for Linux/macOS and one for Windows.

Annoying method

This should work on any OS so long as you have a Java compiler. All you really need to do is download Comparer.java; the other files aren't necessary unless you want to look at them. Compile it like so:

$ javac Comparer.java

Use

See the release instructions if you downloaded a release. If you compiled Comparer.java yourself, proceed:

Run it with the file you want to test as the first argument, making sure you have the text to test the file against in your clipboard. Say you want to compare your clipboard contents to a file called test.txt in your Documents folder:

$ java Comparer ~/Documents/test.txt

Optionally, you can specify start and end line numbers (inclusive) to only compare a section of your file. So, if you want to check lines 2-14:

$ java Comparer ~/Documents/test.txt 2 14

It will print out a line from your file, a corresponding line from your clipboard, and a line below both with ^ symbols to indicate which characters don't match.

Known issue I don't feel like fixing:

This program separates input by newlines. If you input a line that is too long, it will appear to not be reading your file/clipboard line by line, but it should still give you some idea of where you messed up. If you're using this to compare code, chances are you are not going to be having this problem, since you shouldn't be writing super long lines anyways.

code-comparer-for-dummies's People

Contributors

hkcountryman avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.