Skip to content

Instantly share code, notes, and snippets.

View musicm122's full-sized avatar
🏠
Working from home

Terrance Smith musicm122

🏠
Working from home
View GitHub Profile
@musicm122
musicm122 / index.ts
Created May 30, 2019 20:54
Typescript Numeric Array Flatten
/*
Write some code, that will flatten an array of arbitrarily nested arrays of integers into a flat array of integers. e.g. [[1,2,[3]],4] -> [1,2,3,4].
Your solution should be a link to a gist on gist.github.com with your implementation.
When writing this code, you can use any language you're comfortable with. The code must be well tested and documented. Please include unit tests and any documentation you feel is necessary. In general, treat the quality of the code as if it was ready to ship to production.
Try to avoid using language defined methods like Ruby's Array#flatten.
Thank you so much!! *
*/
/**
void Main()
{
// Write code to test your extensions here. Press F5 to compile and run.
}
public static class MyExtensions
{
// Write custom extension methods here. They will be available to all queries.
public static bool IsNumeric(this string theValue)
@musicm122
musicm122 / outlookJournal.vb
Last active September 5, 2017 13:46
Generate Outlook Daily Journal template
Option Explicit
Function GetFormattedCurrentDateString()
GetFormattedCurrentDateString = Format(Now(), "mm/dd/yyyy")
End Function
Function GetFormattedDateString(dateToFormat As Date)
GetFormattedDateString = Format(dateToFormat, "mm/dd/yyyy")
End Function
@musicm122
musicm122 / Twilio.cs
Created January 12, 2017 19:56
Simple Twilio .net example: Making a call and sending an sms
public static class PhoneApi
{
public static void SendMessage(string messageText, string phoneNumber)
{
var accountSid = "YourAccountSid"; // Your Account SID from www.twilio.com/console
var authToken = "YourAuthToken"; // Your Auth Token from www.twilio.com/console
var fromNumber = "+Your From Number";
var twilio = new TwilioRestClient(accountSid, authToken);
var message = twilio.SendMessage(fromNumber, phoneNumber, messageText);
}
@musicm122
musicm122 / Solution.cs
Created January 10, 2017 14:14
FSharpKoansStock_In_CSharp
//https://github.com/ChrisMarinos/FSharpKoans/blob/fsharp/FSharpKoans/AboutTheStockExample.fs#L34
void Main()
{
var result1 = Sol1(stockData);
var result2 = Sol2(stockData.Skip(1).ToArray());
result1.Dump();
result2.Dump();
}
public class Row
@musicm122
musicm122 / ExportAndFormatting.cs
Created December 9, 2016 17:37
Using Scorm Extensions for Export and Formatting
public async Task<string> GetCoursesAsCSV()
{
var appId = "Your Application Id";
var secretKey = "Your Secret Key";
var scormServiceUrl = "https://cloud.scorm.com/EngineWebServices/";
ScormCloud.Configuration = new Configuration(scormEngineServiceUrl: scormServiceUrl, appId: appId, securityKey: secretKey, origin: "");
var result = await ScormCloud.CourseService.GetCourseDetailListAsync();
return result.ToCSVString();
@musicm122
musicm122 / UsingScormExtension.cs
Created December 9, 2016 17:19
Example of how to use scorm extensions
public async Task<List<CourseData>> GetCourses()
{
var appId = "Your App Id";
var secretKey = "Your Secret Key";
var scormServiceUrl = "https://cloud.scorm.com/EngineWebServices/";
ScormCloud.Configuration = new Configuration(scormEngineServiceUrl: scormServiceUrl, appId: appId, securityKey: secretKey, origin: "");
var result = await ScormCloud.CourseService.GetCourseDetailListAsync();
return result;
@musicm122
musicm122 / index.html
Created November 27, 2016 19:21
Uploading a file to S3 in node.js
<html>
<body>
<form method="POST" action="/upload" enctype="multipart/form-data">
<div class="field">
<label for="image">Image Upload</label>
<input type="file" name="image" id="image">
</div>
<input type="submit" class="btn" value="Save">
</form>
</body>

Keybase proof

I hereby claim:

  • I am musicm122 on github.
  • I am hackerferret (https://keybase.io/hackerferret) on keybase.
  • I have a public key whose fingerprint is 42B4 D341 1CFB CF1F 29F3 61D2 8D8B A9AA 8B5F 6E5F

To claim this, I am signing this object:

open System
open System.Globalization
//---------------------------------------------------------------
// Apply Your Knowledge!
//
// Below is a list containing comma separated data about
// Microsoft's stock prices during March of 2012. Without
// modifying the list, programatically find the day with the
// greatest variance between the opening and closing price.
//