Skip to content

Instantly share code, notes, and snippets.

@askingalot
askingalot / exp_parser.erl
Created August 16, 2013 02:11
This is my attempt to solve the very first part of Exercise 3-8 from the O'reilly Erlang Programming book. This module *should* parse a simple mathematical expression into an erlang data structure. It does that (save unary negation) but it does so by wrapping each expression and sub expression in a tagged tuple. The trouble is, I can't seem to u…
-module(exp_parser).
-export([parse/1]).
% Parse simple math expressions.
% Currently works (for certain definitions of "works")
% for addition, subtraction and multiplication.
% Eventually it should handle a unary negation operator (~)
% The goal is to do the following:
% parse("(2 + 3)") => {plus, {num, 2}, {num, 3}}
@askingalot
askingalot / gist:8247791
Last active January 2, 2016 03:59
...haven't come across Enhancement I or II
If Request.Form("OpImpactType") <> "0" Then
Select Case Request.Form("direction")
Case "2"
opdir= "Southbound traffic is affected with "
Case "3"
opdir = "Northbound traffic is affected with "
Case "4"
opdir = "Westbound traffic is affected with "
Case "5"
opdir = "Eastbound traffic is affected with "
@askingalot
askingalot / GetAllStudents.cs
Created March 21, 2019 19:44
Repository.GetAllStudents() Method
public List<Student> GetAllStudents()
{
using (SqlConnection conn = Connection)
{
conn.Open();
using (SqlCommand cmd = conn.CreateCommand())
{
cmd.CommandText = @"select s.id as StudentId,
s.FirstName,
s.LastName,
@askingalot
askingalot / APIIntegrationTestSetup.md
Last active March 29, 2019 18:19
Steps to Setup Integration Testing for ASP.NET Core Web API

Steps

  1. Open your Web API solution in Visual Studio
  2. In the Solution Explorer, right-click the Solution to open a menu.
  3. Use the menu select Add / New Project to open the Add New Project dialog.
  4. On the left panel, click the Test node under Visual C#.
  5. In the center panel, click xUnit Test Project (.NET Core).
  6. Enter a name for your project in the Name textbox at the bottom of the form. (something like "<YOUR_WEB_API_PROJECT_NAME>.Tests", ex. StudentExercisesAPI.Tests)

Now we need to setup the new Test Project with a reference to your Web API project AND with the correct Nuget packages needed to perform Integration Tests. Visual Studio offers several different ways of adding these references, however, the simplest way is to edit the test project's .csproj file.

  1. In the Solution Explorer, right-click the Test Project and select Edit .csproj in the middle of the context menu.

Calculator Challenge

Part One

Build a console application that presents the user with the following menu:

Welcome to Calculatron 3000!
1) Add two numbers
2) Subtract two numbers
3) Multiply two numbers
@askingalot
askingalot / GuessTheNumber.md
Last active September 23, 2020 21:36
Guess The Number C# Exercise

Guess The Number

A C# Exercise

Write a console program in C# that invites the user to guess a number.

The program should be written in increments. Each "phase" will add a little more complexity.

Phase 1

@askingalot
askingalot / PlanYourHeist.md
Last active February 25, 2020 21:54
Plan Your Heist - A C# Exercise
@askingalot
askingalot / Top10Files.md
Created October 7, 2019 21:41
Top 10 Files - A C# Exercise

Top 10 Files

A C# Exercise

Phase 1

Create a console application that displays the top 10 most recently downloaded files in your Downloads directory.

TIP You may find these classes/methods helpful

blatantly stolen adapted from https://gist.github.com/AdamSheaffer/ec09a8b8a1edabbfc4d2ca7f8719abd7

Classy Electronics

You've just started working for a boutique electronic company and you've been tasked with modeling their new line of record players.

Step 1:

The company's most basic product line is simple turntables that can support rpm speeds of 33, 45, and 78

@askingalot
askingalot / Workforce SQL Exercise.md
Last active November 7, 2019 15:23
Bangazon SQL Exercise

Write the appropriate SQL to answer the following questions

NOTE: Some of these questions will require googling and/or asking for help from your instructors.

  1. List each employee first name, last name and supervisor status along with their department name. Order by department name, then by employee last name, and finally by employee first name.
  2. List each department ordered by budget amount with the highest first.
  3. List each department name along with any employees (full name) in that department who are supervisors.
  4. List each department name along with a count of employees in each department.
  5. Write a single update statement to increase each department's budget by 20%.
  6. List the employee full names for employees who are not signed up for any training programs.