Skip to content

Instantly share code, notes, and snippets.

View matt6frey's full-sized avatar

Matt Frey matt6frey

View GitHub Profile
function triangle(len) {
const arr = [];
let triangleStr = "*";
for(let i = 0; i < len; i++) {
arr.push(triangleStr); // adds a node to array
triangleStr += " *"
}
return arr.join("\r\n");
}
// Vuex
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
state: {
firstName: 'Charlie'
@matt6frey
matt6frey / Classes.cs
Last active December 15, 2019 23:59
Example of Creating classes with constructor methods and calling their methods.
using System;
namespace CSharpTuts
{
class Program
{
static void Main(string[] args)
{
Human scarlet = new Human("Scarlet", "Johanson", "1984-11-24", 'f');
Human markus = new Human("Markus", "Aurelius", "2014.12.16"); // obvi it's not his real DOB.
using System;
namespace CSharpTuts
{
class Program
{
static void Main(string[] args)
{
WriteName("The Dude");
PrintAge(45);
@matt6frey
matt6frey / parsing-strings.cs
Created December 15, 2019 01:18
Demonstrates parsing numbers inside strings.
using System;
namespace CSharpTuts
{
class Program
{
static void Main(string[] args)
{
string firstNum = "47";
string secondNum = "99";
@matt6frey
matt6frey / datatype-conversions.cs
Last active December 15, 2019 01:08
Shows Explicit, Implicit and type conversion in C#
using System;
namespace CSharpTuts
{
class Program
{
static void Main(string[] args)
{
// explicit conversion
double doubleNum = 123.3;
// fn()
function digitizeVowels(str) {
return str.split('').map((letter) => {
if(letter.search(/a|e|i|o|u/gi) > -1) {
return letter.replace(/a|e|i|o|u/gi, (Math.random() * 10).toFixed(0) )
} else {
return letter;
}
}).join('');
}