This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1) 'ref' | |
// ref keyword means "pass by reference" - edits | |
// made in this function affect the actual variable | |
int someNum = 5; | |
AddOne(ref someNum); | |
// someNum now = 6 | |
void AddOne(ref int i) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Save the username and password globally: | |
git config --global user.name "fname lname" | |
git config --global user.email "[email protected]" | |
git config --global user.password "secret" | |
Get a specific setting, | |
git config --global --get user.name | |
git config --global --get user.email | |
git config --global --get user.password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.EntityFrameworkCore; | |
using Microsoft.EntityFrameworkCore.Diagnostics; | |
using AdamsTaxAPI.Data; | |
using AdamsTaxAPI.Data.MagentoServiceCalls; | |
using AdamsTaxAPI.Models; | |
using AdamsTaxAPI.Controllers; | |
using Azure.Identity; | |
using Azure.Security.KeyVault.Secrets; | |
using Aczure.Extensions.AspNetCore.Configuration.Secrets; | |
using Reni.SshNet.Sftp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dapperParams = new List<KeyValuePair<object, object>>() { | |
new KeyValuePair<string, string>("FirstName", "Chris"), | |
new KeyValuePair<string, string>("LastName", "Money"), | |
new KeyValuePair<string, string>("Phone", "314-555-1212"), | |
new KeyValuePair<string, string>("SSN", "123-45-6789"), | |
new KeyValuePair<string, int>("Age", 21) | |
}; | |
connection.Query<Person>(query, new {dapperParams}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UI: UI files driven by Factory methods | |
Helper: Wrapper methods that handle misc. functions | |
API: API calls envoked at the factory level | |
Factory/Business: Handles SQL Connections, santizes data before handing off to DAO | |
DAO: Handles requests to data warehouse and returns objects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(string, string, string) LookupName(long id) // tuple return type | |
{ | |
... // retrieve first, middle and last from data storage | |
return (first, middle, last); // tuple literal | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var xhr = new XMLHttpRequest; | |
xhr.open("GET", url); | |
xhr.send(); | |
// ******************************** | |
// Return Json object from server | |
// ******************************** | |
var id = 1; | |
var req = new XMLHttpRequest(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>First name: <input data-bind="value: firstName" /></p> | |
<p>Last name: <input data-bind="value: lastName" /></p> | |
<h2>Hello, <span data-bind="text: fullName"> </span>!</h2> | |
// data model | |
var ViewModel = function(first, last) { | |
this.firstName = ko.observable(first); | |
this.lastName = ko.observable(last); | |
this.fullName = ko.pureComputed(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
A promise in JavaScript is an object that represents the eventual completion or failure of an asynchronous operation. | |
*/ | |
new Promise((resolveOuter) => { | |
resolveOuter( | |
new Promise((resolveInner) => { | |
setTimeout(resolveInner, 1000); | |
}), | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Observables allow you to track changes or data over time, | |
rather than just waiting for a single result like with promises. | |
*/ | |
// Create an Observable that emits a value every second | |
const observable = Rx.Observable.interval(1000); | |
// Subscribe to the Observable and print the emitted values to the console | |
observable.subscribe(value => console.log(value)); |
NewerOlder