Skip to content

Instantly share code, notes, and snippets.

View AkashNeil's full-sized avatar

Neil AkashNeil

View GitHub Profile
@AkashNeil
AkashNeil / mongoDB_create_collection_with_some_values.js
Created March 1, 2019 09:57
Create collection with some values.
db.createCollection("citiesOfGermany");
db.getCollection("citiesOfGermany").insert([
{
"name" : "Berlin",
"countryCapital" : true
},
{
"name" : "Dortmund",
"countryCapital" : false
@AkashNeil
AkashNeil / mongoDB_set_value_to_field_for_specific_records.js
Created March 1, 2019 09:45
Sets value to field for specific records.
var teamsToSetDomesticChampionStatus = ["Real Madrid", "Bayern Munich", "Barcelona"]
db.getCollection("teams").find({name:{$in: teamsToSetDomesticChampionStatus}}).forEach(function(team) {
db.getCollection("teams").update(team, {$set: {domesticChampion: true}});
})
@AkashNeil
AkashNeil / mongoDB_deleteField.js
Last active March 1, 2019 09:39
Delete a field in a collection.
db.getCollection("collectionName").update(
{ 'fieldName': { '$exists': true } }, // Query
{ '$unset': { 'fieldName': true } }, // Update
false, // Upsert
true // Multi-update
)
@AkashNeil
AkashNeil / Destructuring_Arguments_1.js
Created January 7, 2019 10:35
JavaScript – Destructuring Arguments
function getData({bestTeam, bestLeague }) {
return `${bestTeam} ${bestLeague}`;
}
const x = {bestTeam: "Real Madrid", bestLeague: "La Liga"};
getData(x);
// "Real Madrid La Liga"
@AkashNeil
AkashNeil / let_scope.js
Created January 7, 2019 10:28
The 'let'​ statement's scope in JavaScript.
var x = 70;
var y = 80;
if (a === 0) {
var x = 10;
let y = 20;
console.log(x); // result 1
console.log(y); // result 2
@AkashNeil
AkashNeil / Problem_with_node-sass
Last active January 6, 2019 17:35
When faced with a node-sass issue.
When faced with a node-sass issue, such as:
Error: Cannot find module 'node-sass'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:587:15)
at Function.Module._load (internal/modules/cjs/loader.js:513:25)
at Module.require (internal/modules/cjs/loader.js:643:17)
at require (internal/modules/cjs/helpers.js:22:18)
Execute the command:
@AkashNeil
AkashNeil / ArtifactorySetup.md
Last active January 4, 2019 12:16
Steps to setup JFrog Artifactory

JFrog

  1. Ensure that Maven and Java are installed.
  2. Download Artifactory (ZIP version)
  3. Unzip and run bin\artifactory.bat
  4. Artifactory will be available on localhost:8081
  5. Deploy to artifactory:
  • cd where the pom.xml is located
  • Run "mvn deploy -Dusername=admin -Dpassword=password -Dbuildnumber=1" or "mvn deploy -Dbuildnumber=1 -s settings.xml"
  1. Check status on Artifactory
@AkashNeil
AkashNeil / tomcat_version.md
Last active January 4, 2019 12:09
Checking Tomcat version

Tomcat Logo

To find out the Tomcat version, we need to find the file – version.sh (unix) or version.bat (windows). The file is usually found in the Tomcat bin folder.

To find the version.sh file: sudo find / -name "version.sh"

Find out everything about Tomcat (where name = server name): sudo find / -name "apache-tomcat8"

@AkashNeil
AkashNeil / copy_a_row_multiple_times
Created September 6, 2018 07:13
VBA file to copy a specific row multiple times in Excel
Sub test()
Dim xCount As Integer
LableNumber:
xCount = Application.InputBox("Number of Rows", "Excel", , , , , , 1)
If xCount < 1 Then
MsgBox "The entered number of rows not valid, please enter again.", info, "Excel"
GoTo LableNumber
End If
ActiveCell.EntireRow.Copy
Range(ActiveCell.Offset(1, 0), ActiveCell.Offset(xCount, 0)).EntireRow.Insert Shift:=xlDown
@AkashNeil
AkashNeil / add_to_win10_context_menu.md
Created August 22, 2018 11:19
Adding items to Windows 10 context menu (right click)
  1. Look for "regedit" and open it.
  2. Go to Computer\HKEY_CLASSES_ROOT\Directory\Background\shell\
  3. Right click on shell > New > Key
  4. Enter a name, e.g. "MyApp"
  5. Right click on "MyApp" > New > Key
  6. Enter the name "command"
  7. Click on "command" and then in the right plane, double click on the paper like icon and enter the path of the application; e.g. "C:\Program Files (x86)\MyApp.exe"