Skip to content

Instantly share code, notes, and snippets.

View shemmjunior's full-sized avatar
🎯
Focusing

Shemm Junior shemmjunior

🎯
Focusing
View GitHub Profile
@shemmjunior
shemmjunior / clean_my_mac.sh
Last active October 3, 2025 08:35
Clean macos unused files
#!/bin/bash
# Apps you want to protect (e.g. JetBrains IDEs, Xcode, etc.)
guardedApps=(JetBrains Xcode)
# Directories to clean
guardedLocations=(
"$HOME/Library/Caches"
"$HOME/Library/Logs"
"/Library/Caches"
@shemmjunior
shemmjunior / get-all-error-fields-on-form-validation.ts
Last active June 6, 2022 10:00
Get error fields on form validation
getFormValidationErrors(): any {
const errors = [];
Object.keys(this.tenantForm.controls).forEach(key => {
const controlErrors: ValidationErrors = this.tenantForm.get(key).errors;
if (controlErrors != null) {
Object.keys(controlErrors).forEach(keyError => {
errors.push({
'field': key,
'error': keyError,
@shemmjunior
shemmjunior / nginx-proxy
Created May 27, 2022 15:28
Nginx reverse proxy get real user ip
location / {
proxy_pass https://fotogena.co:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; # This line.
proxy_connect_timeout 1000;
proxy_send_timeout 1500;
proxy_read_timeout 2000;
@shemmjunior
shemmjunior / multiple_array_exists_check.ts
Created March 31, 2022 17:09
Check if value in object exists im multiple array
let array1 = [{name: 'Peter'}, {name: 'Alex'}, {name: 'John'}];
let array2 = [{name: 'James'}, {name: 'Alice'}, {name: 'Peter'}]
const new_array = this.array1.map((a) => {
a['exists'] = this.array2.some((s) => s.name === a.name) ? true : false;
return a;
});
console.log(new_array);
@shemmjunior
shemmjunior / CountryCodes.json
Created March 27, 2022 07:07 — forked from anubhavshrimal/CountryCodes.json
Country and Dial or Phone codes in JSON format
[
{
"name": "Afghanistan",
"dial_code": "+93",
"code": "AF"
},
{
"name": "Aland Islands",
"dial_code": "+358",
"code": "AX"
@shemmjunior
shemmjunior / scroll_instagram.js
Created October 22, 2021 04:41 — forked from LoranKloeze/scroll_instagram.js
Automatic scroll of Instagram page, stop scrolling by hand...
/*
Tired of scrolling to one of the last photos on the page on Instagram? Let your
browser do the scrolling for you!
31-05-2017
(c) 2017 - Loran Kloeze - loran@ralon.nl
Usage
- Go to https://www.instagram.com/instagram_handle/ (change instagram_handle in i.e. taylorswift)
- Open up the console (F12) (Firefox users: type 'allow pasting' if you haven't done so yet)
- Select the contents of this complete file and copy/paste it to the console and hit enter
@shemmjunior
shemmjunior / animals.json
Created October 10, 2021 19:03 — forked from borlaym/animals.json
Array of animal names
[
"Aardvark",
"Albatross",
"Alligator",
"Alpaca",
"Ant",
"Anteater",
"Antelope",
"Ape",
"Armadillo",
const cors = require('cors')
// Set `useWhitelist` to `false` if you want to accept all requests.
const config = {
useWhitelist: true
}
// Define from which origins requests are allowed.
const whitelist = [
// 'https://fiddle.jshell.net',
@shemmjunior
shemmjunior / countries.json
Created October 3, 2021 06:49 — forked from keeguon/countries.json
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},