Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am dancoughlin on github.
  • I am dmc186 (https://keybase.io/dmc186) on keybase.
  • I have a public key ASCy5mPeiInwr1fP8EzHumvQguHzAo5kUHbU9_jyFOJZ1Qo

To claim this, I am signing this object:

@DanCoughlin
DanCoughlin / Quiz Answer
Created October 31, 2019 23:19
Answer to question 8 in quiz #module5
/*
8. Write a Java code snippet to ask a user how many classes they are taking this semester.
Create an array of courses to based on that input, and then ask the user
to enter each course and and put those in the courses array. When the user has
completed entering their courses, print out the list of courses under the
heading "----Sprint 2019 Course Schedule------". Final output should be something like:
----Sprint 2019 Course Schedule------
IST140
MATH110
ENG015
// part a
String[][] songs = {
{"Come Together", "Something", "Maxwell's Silver Hammer", "Oh! Darling", "Octopus's Garden", "I Want You"},
{"Here Comes the Sun", "Medley", "Her Majesty" }
};
for (int i=0; i < songs.length; i++) {
System.out.println("Side: " + (i+1));
for (int j=0; j < songs[i].length; j++) {
System.out.println(songs[i][j]);
}
@DanCoughlin
DanCoughlin / gist:ec921c4465955f673bd4b5f8656bc1d7
Created October 29, 2019 18:41
2D Array and Display #module5
String[][] results =
{
{"homeLabs", "1500 sq feet", "169.99", "4.6", "HME020030N"},
{"Inofia", "1050 sq feet", "130.04", "4.4", "GA2"},
{"Yaufey", "1500 sq feet", "159.99", "4.5", "163A"},
{"homeLabs", "4500 sq feet", "204.99", "4.6", "HME020031N"}
};
String[] labels = {"Manufacturer", "Coverage", "Price", "Avg Rating", "Model #"};
for (int i=0; i < results.length; i++) {
System.out.printf("%15s%n", "Product " + (i+1));
@DanCoughlin
DanCoughlin / gist:84d366d397090f677aa25a006f8bdf35
Last active October 29, 2019 18:27
2D Random Array and Max Value #module5
/*
a:
Create a two dimensional array that is
5 rows (outer loop) referenced with first set of brackets [x][]
by
10 columns (inner loop) referenced with second set of brackets [][x]
put a random number between 1-100 in each position.
b:
Print out all the numbers in a 5 row by 10 column format
@DanCoughlin
DanCoughlin / gist:28f20bb50481c21eec60f175972ea366
Created June 30, 2017 18:48
Opening a CSV and parsing it out
require 'csv'
namespace :break_up_csv do
desc "take the OSP file and merge it with the active AI User accounts
to get a file (found.xls) that has OSP grant data with all user info
and another file (not_found.xls) that includes the OSP grant data that
doesn't have matching users"
task split_files: :environment do
puts "open data file."
$npm start
> mypubs-tester@1.0.0 start /Users/dmc186/mypubs
> node --harmony addItems.js
Uploading items:
Unhandled rejection Error: Forbidden
at Message.Object.defineProperties.error.get (/Users/dmc186/mypubs/node_modules/zotero/lib/message.js:196:19)
at Message.<anonymous> (/Users/dmc186/mypubs/node_modules/zotero/lib/client.js:150:21)
@DanCoughlin
DanCoughlin / week3challenge.sh
Created September 10, 2015 00:38
searching a file provided for key words provided and printing the number of times it has been found.
#!/bin/bash
# give counts for two different variables
# for any file passed
# and output the values
n1=`grep -i $1 $3 | wc -l`
n2=`grep -i $2 $3 | wc -l`
# output the values
echo In file: $3
echo I found $1 $n1 times
@DanCoughlin
DanCoughlin / gist:e26bc99c74b2d75e5bac
Created August 12, 2015 15:45
Demonstration of creating cURL to get repos from archivespace
repo_id = 3
login_url = "http://<url to hit>/users/<user name to login as>/login"
repo_url = "http://<url to hit>/repositories/#{repo_id}/"
all_repos_url = "#{repo_url}/resources?all_ids=1"
ind_repo_url = "#{repo_url}/resources/"
c = Curl::Easy.http_post(login_url, Curl::PostField.content('password', '<config var>'))
json = JSON.parse(c.body_str)
token = json['session']
repos = Curl.get(all_repos_url) do |http|
http.headers['X-ArchivesSpace-Session'] = token
@DanCoughlin
DanCoughlin / gist:f97d719bb40855366e98
Created April 30, 2015 18:02
application.css.sass
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new