Skip to content

Instantly share code, notes, and snippets.

View dcyoung-dev's full-sized avatar
🥞
Full Stacking

David Young dcyoung-dev

🥞
Full Stacking
View GitHub Profile
@dcyoung-dev
dcyoung-dev / app.component.html
Created April 14, 2019 21:29 — forked from RajaShanmugamJM/app.component.ts
Simple Google Map Integration with Angular.
<div id="map">
<h4>From map</h4>
</div>
<div id="loc_details">
<h4>Current Location</h4>
<p>
Lat : {{geoLoc.lat }}
</p>
<p>
@dcyoung-dev
dcyoung-dev / Don't install NPM packages globally
Created April 15, 2019 16:35
Using NPX to install locally rather than globally
`npx -p <package-name> <command>`
eg.
Create new Angular project
`npx -p @angular/cli ng new new-project-name`
Create new NextJS project
`npx -p @nextjs/cli next new new-project-name`
@dcyoung-dev
dcyoung-dev / ng8-lazy-app-routing.module.ts
Created May 29, 2019 10:59
Angular 8 changes the way in which we lazily load routes from other modules
const routes: Routes = [
{
path: 'old-lazy',
loadChildren: './old-lazy/old-lazy.module#OldLazyModule'
},
{
path: 'new-lazy',
loadChildren: () => import('./new-lazy/new-lazy.module')
.then(m => m.NewLazyModule)
}
<h1>Product Records</h1>
<div *ngFor="let record of productRecords | async">
{{record.itemNumber}}
</div>

Switching from bash to zsh

  1. Install zsh using brew brew install zsh
  2. Set ZSH as default shell chsh -s /bin/zsh
  3. Copy bash profile cat ~/.bash_profile >> ~/.zshrc
@dcyoung-dev
dcyoung-dev / teminal_get_unique_from_paste.sh
Last active June 12, 2019 12:25
Gets the unique vales from clipboard.Use `-c` to add the count
#!/bin/bash
pbpaste | sort | uniq
@dcyoung-dev
dcyoung-dev / README.md
Last active April 1, 2020 10:01
CSS Rules Draft

CSS Rules for Harmonious Living

Sizing

  • Prefer to use em/rem rather than px
    • rem is the browser's default size - usually equal to 16px
    • em is relative to it's parent's sizing
  • Consider which sizing makes most sense - should the sizing increase if the parent's increases (em) or should it remain constant (rem).

Colours

  • Always move colours into a separate file and reference through CSS variables var()
@dcyoung-dev
dcyoung-dev / fizz_buzz.rb
Created December 15, 2020 07:45
Fizz Buzz solution in Ruby
# FizzBuzz
def add_trigger_word(number, factor, output_array, word)
output_array << word if number % factor == 0
output_array
end
word_map = {
3 => "Fizz",
5 => "Buzz",
@dcyoung-dev
dcyoung-dev / custom-jquery-functions.html
Created April 8, 2021 13:44
Create your own custom jQuery functions
<script>
// Declaring a new jQuery function
(function ($) {
$.fn.newSuperCoolFunction = function () {
return this.each(function (_, selector) {
var elements = $(selector)
elements.each(function (_, elementSelector) {
var element = $(elementSelector);
element.addClass('super-cool')
@dcyoung-dev
dcyoung-dev / netlify.toml
Created May 24, 2021 15:12
Opt-out of Google's FLoc tracking on Netlify
# Stop Google's FLoc https://andycroll.com/ruby/opt-out-of-google-floc-tracking-on-netlify
[[headers]]
for = "/*"
[headers.values]
Permissions-Policy = "interest-cohort=()"