Skip to content

Instantly share code, notes, and snippets.

View RadoslawB's full-sized avatar
🎯
Focusing

Radosław Białowąs RadoslawB

🎯
Focusing
View GitHub Profile
@alexzuza
alexzuza / lazy-load-script.service.ts
Created October 30, 2018 15:42
Load script on demand
import { Injectable, Inject } from '@angular/core';
import { ReplaySubject, Observable } from 'rxjs';
import { DOCUMENT } from '@angular/common';
@Injectable()
export class LazyLoadingScriptService {
_loadedLibraries: { [url: string]: ReplaySubject<any> } = {};
constructor(@Inject(DOCUMENT) private readonly document: any) { }
@HarshadRanganathan
HarshadRanganathan / letsencrypt
Last active March 18, 2021 06:28
Let's Encrypt SSL for Nginx in Amazon Linux AMI instance
# Install wget
yum install wget -y
# Install certbot-auto
wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
# Obtain SSL certificate with Nginx plugin for the domain
sudo ./certbot-auto --nginx -d app.com --debug
@anthonyray
anthonyray / gist:398fde676a7704c03d6624155ba0011e
Last active May 6, 2024 06:15
Set up OhMyZsh on Amazon EC2 instance running Ubuntu Server 14.04
  1. Connect to your EC2 instance
  2. Install zsh : sudo apt-get update && sudo apt-get install zsh
  3. Edit your passwd configuration file to tell which shell to use for user ubuntu : sudo vim /etc/passwd
  4. Look for ubuntu user, and replace bin/bash by bin/zsh
  5. Install OhMyZsh : sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
  6. Disconnect from your instance and reconnect it.
@wojteklu
wojteklu / clean_code.md
Last active July 19, 2024 09:29
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@coryhouse
coryhouse / authorApi.js
Created August 6, 2015 13:04
Mock Author API for "Building Applications with React and Flux" on Pluralsight
"use strict";
//This file is mocking a web API by hitting hard coded data.
var authors = require('./authorData').authors;
var _ = require('lodash');
//This would be performed on the server in a real app. Just stubbing in.
var _generateId = function(author) {
return author.firstName.toLowerCase() + '-' + author.lastName.toLowerCase();
};