Skip to content

Instantly share code, notes, and snippets.

Avatar
📖
Always Learning

Matthew Kosloski MatthewKosloski

📖
Always Learning
View GitHub Profile
View app.component.ts
import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { OnInit } from '@angular/core';
import { map } from 'rxjs/operators';
import { Observable } from 'rxjs';
interface Todo {
userId: number
id: number
title: string
View angular_architecture.md

Modules

  • An NgModule declares a compilation context for a set of components that is dedicated to an application domain, a workflow, or a closely related set of capabilities.
  • An NgModule can associate its components with related code, such as services, to form functional units.
  • The root module, AppModule, typically resides in a file named app.module.ts.

Metadata

An NgModule is defined by a class with the @NgModule() decorator, which is a function that tkaes a single metadata object. Some of the most important properties are:

  • declarations: The components, directives, and pipes that belong to the module.
  • exports: The subset of declarations that should be visible in the component templates of other modules.
  • imports: Other modules whose exported classes are needed by component templates declared in this module.
View ssh_cheatsheet.md

SSH Cheatsheet

You know how it goes. SSH is something that nearly every developer uses every day, however, they only set it up a couple of times and then forget about it. And whenever you need to authenticate with SSH again, you just look up how to do it, never remembering how to do it because why would you?

SSH Protocol

What is it?

SSH, which stands for Secure Shell, is a network protocol that enables a client to securely connect to a remote server. All user authentication, commands, outputs, and file transfers are encrypted to protect against attacks in the network. It is a more secure alternative to non-protected login protocols such as FTP.

@MatthewKosloski
MatthewKosloski / .vimrc
Created Apr 12, 2020
My Vim Configuration
View .vimrc
" Automatically install vim-plug
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Install plugins
call plug#begin()
Plug 'preservim/nerdtree'
View git_branch_cheatsheet.md

Branches

Creating branches

Creates a new branch:

  git branch <branchname>

Create a new branch and switch to it with the following command. Any prior commits will be a part of the branch as well as the master.

  git checkout -b <branchname>
@MatthewKosloski
MatthewKosloski / spy_and_stub.js
Last active Oct 16, 2016
An example of a spy and stub
View spy_and_stub.js
import expect from 'expect';
import sinon from 'sinon';
import fetch from 'isomorphic-fetch';
describe.only('Sinon samples', () => {
describe('spy', () => {
let spy;
before(() => {
let add = (...args) => args.reduce((a, b) => a + b);
View repack-apps-spotify-directory.txt
/*
Repacks the Spotify modules
It converts your folder into a .spa file. (e.g., profile -> profile.spa)
All module folders will be deleted after running this.
As a result, the root directory will only contain .spa files. (ready to be placed into Spotify's contents)
To run, simply `cd` into the root Apps folder of your skin.
Then, take said folder and replace it with Spotify's Apps directory found at `/Applications/Spotify.app/Contents/Resources/Apps`
@MatthewKosloski
MatthewKosloski / extract-apps-spotify-directory.txt
Last active Apr 6, 2021
Extracts each .spa file in Spotify's Apps directory without manually doing it yourself.
View extract-apps-spotify-directory.txt
/*
Extracts each .spa file in Spotify's Apps directory without manually doing it yourself.
The default folder is put on the desktop.
To change that, change the following part of the command:
`~/Desktop/Apps && cd ~/Desktop/Apps`
Procedure:
1. Change directory to /Applications/Spotify.app/Contents/Resources/Apps
2. Copy the files within the directory to ~/Desktop/Apps and change directory