Skip to content

Instantly share code, notes, and snippets.

View naeluh's full-sized avatar
🌐
Busy

nick hulea naeluh

🌐
Busy
View GitHub Profile
@naeluh
naeluh / useRawParams.js
Created October 27, 2023 19:36 — forked from Kostanos/useRawParams.js
Getting RAW (without URL decode) params from react-router-dom.
import { useContext, useMemo } from 'react';
// eslint-disable-next-line camelcase
import { UNSAFE_RouteContext, useParams } from 'react-router-dom';
/**
* Temporary workaround to get RAW params from react-router-dom v.6
* Should hanndle most of the simple cases like /:myVar/someVar/:mySecondVar
* @returns {Object} The same as useParams from react-router-dom but returns RAW (not URL decoded) paramters
*/
export default function useRawParams() {
@naeluh
naeluh / download website assets
Created January 19, 2023 17:40 — forked from christiangenco/download website assets
Use wget to download a website's assets, including images, css, javascript, and html. From http://www.linuxjournal.com/content/downloading-entire-web-site-wget
$ wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--domains website.org \
--no-parent \
www.website.org/tutorials/html/
@naeluh
naeluh / instructions.md
Created July 13, 2021 22:44 — forked from sveggiani/instructions.md
[Configure XDebug, Visual Studio Code for a Vagrant VM] #debug #vm #vscode

Configure XDebug, Visual Studio Code for a Vagrant VM

1. Assumptions

  • Project (Drupal) is served on /var/www/html in the Vagrant box
  • Local project files location: c:\Users\username\Work\projects\my-project\repo\html
  • Guest machine IP is 10.0.2.2 (if this doesn't work, run route -nee in the VM and look for the gateway address)

2. Configuration

@naeluh
naeluh / TruncateHtmlExtension.php
Created March 4, 2020 18:37 — forked from leon/TruncateHtmlExtension.php
Symfony 2 Twig Extension that truncates html and preserves tags
<?php
/**
Truncate Html string without stripping tags
register in Resources/config/services.yml with:
services:
truncatehtml.twig.extension:
class: Radley\TwigExtensionBundle\Extension\TruncateHtmlExtension
tags:
- { name: twig.extension }
@naeluh
naeluh / array_iteration_thoughts.md
Created January 16, 2020 20:24 — forked from ljharb/array_iteration_thoughts.md
Array iteration methods summarized

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and

@naeluh
naeluh / multiple_ssh_setting.md
Created October 3, 2019 18:29 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"

Install Mongo with WSL for Windows.

Home

This doc will guide you through installing Mongo DB using WSL through the Command Line.

Most of the steps are listed out here, but this guide will trim them down and make it more straight forward for our needs. There is also 1 step that is not in the link above as well, which will be noted when we come across it.

Install MongoDB Community Edition.

  1. Open a Windows PowerShell and type wsl.
@naeluh
naeluh / mongoexport-all-collections-as-json.sh
Created February 21, 2019 21:40 — forked from thbkrkr/mongoexport-all-collections-as-json.sh
Export all MongoDB collections to JSON
#!/bin/bash
DB=$1
COLLECTIONS=$(mongo localhost:27017/$DB --quiet --eval "db.getCollectionNames()" | sed 's/,/ /g')
for collection in $COLLECTIONS; do
echo "Exporting $DB/$collection ..."
mongoexport -d newtickettoolDB -c $collection -o $collection.json
done
@naeluh
naeluh / Git push deployment in 7 easy steps.md
Created February 14, 2019 04:14 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@naeluh
naeluh / git-deployment.md
Created February 14, 2019 04:14 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your lokal GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like my Deepl.io to act upon a Web-Hook that's triggered that service.