Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am rszewczyk on github.
  • I am szewczyk (https://keybase.io/szewczyk) on keybase.
  • I have a public key ASCB0ImqZCnmMYuF8jnyGVfepGbT-QNygunM_Bixq74FCwo

To claim this, I am signing this object:

@rszewczyk
rszewczyk / emotion-jest-dom.js
Created April 6, 2018 16:34
Emotion jest snapshot serializer for DOM elements
// proof of concept for jest-emotion style snapshots for DOM Elements
import * as css from 'css'
function defaultClassNameReplacer(className, index) {
return `emotion-${index}`
}
const componentSelectorClassNamePattern = /\.e[a-zA-Z0-9-]+[0-9]+/
export const replaceClassNames = (
@rszewczyk
rszewczyk / insertsort.c
Created December 5, 2017 23:19
CMSC 104 - insertion sort
#include <stdio.h>
void printIntegerArray(int array[], int size)
{
int currentIndex = 0;
while (currentIndex < size)
{
printf("%d\n", array[currentIndex]);
currentIndex = currentIndex + 1;
}
@rszewczyk
rszewczyk / practice-solutions.markdown
Last active December 5, 2017 23:11
CMSC 104 Final Exam Review

Practice Final - Answers

1.

Remove the & on line 8

Change %C to %s on line 10

2.

@rszewczyk
rszewczyk / assignment.markdown
Created November 21, 2017 22:27
CMSC 104 - Class 22

Assignment - Class #22 11/21/2017

In this assigment you will learn about arrays in C.

As part of this assigment you will create a program in a file called arrays2.c. When you complete the assigment you will submit arrays2.c by uploading it to me on Slack. If you do not finish today, you have until the start of class on Tuesday 11/28/2017 to submit it.

Create a file called arrays2.c and paste in the following contents:

@rszewczyk
rszewczyk / arrays1.c
Last active November 21, 2017 22:09
CMSC 104 Class 21
#include <stdio.h>
int main()
{
int arraySize = 0;
while (arraySize < 1)
{
printf("Enter array size: ");
scanf("%d", &arraySize);
if (arraySize < 1)
@rszewczyk
rszewczyk / loops.markdown
Last active November 21, 2017 21:52
CMSC 104 - Additional Practice Problems

Additional Practice Problems: Loops

Here are some optional practice problems to help you learn loops. You can implement all of them using either for or while loops - or try both!

Problem 1

Part A

Write a program that asks the user to enter a positive integer. It should continue to prompt the user until they enter

@rszewczyk
rszewczyk / assignment.markdown
Created November 14, 2017 23:12
CMSC 104, Class 20 - 11/14/2017

In Class Assignment

Create file called stars2.c and paste the contents of stars.c from Class 16 into it.

Compile and run the program to make sure it works. Then modify the the code so that the part that prints the stars uses for loops instead of while loops (the part from line 18 to the end).

Submit your program to me on Slack. If you don't finish today, it is due by the end of next class (11/16/2017).

Optional Practice Problem

@rszewczyk
rszewczyk / assignment.markdown
Last active November 9, 2017 22:04
CMSC 104 - Class 19 11/9/2017

Class 19 Assignment

If you haven't already done so, complete the class 18 assigment and submit it.

When you are done save circles.c to another file called circles2.c. Modify it so that the program will run a maximum of 5 calulcations - i.e. immediately after the program performs its fifth calculation it exits. It should still also exit if the user at any point chooses not to continue.

The program should inform the user if it is exiting because it's reached the maximum calculations.

@rszewczyk
rszewczyk / assignment.markdown
Last active November 7, 2017 22:19
CMSC 104 - Class 18

In class assignment

Finish the in class assigment from class 17 if you haven't already done so. You are strongly encouraged to complete the optional practice problems as well.

Write a program that prompts the user for two numbers, each of which represents the radius of a circle. Your program will then calculate the difference in areas if you subtract the area of the smaller circle from the area of the bigger circle. Your program will then print the difference then ask the user if they wish to do another calculation. If they type the character y, the program