Skip to content

Instantly share code, notes, and snippets.

View jonathanrodriguezs's full-sized avatar

Jonathan Rodriguez jonathanrodriguezs

View GitHub Profile
@BritneyJo
BritneyJo / ES2015.md
Last active February 11, 2021 07:02

ES6 / ES2015

Learning Objectives

  • Understand what ES2015 is and how to use it
  • Exposure to and implementation of many of the most useful new features introduced in ES2015:
    • String Interpolation
    • Arrows
    • Let vs. Const vs. Var
    • Classes
@mdang
mdang / ES6_PRACTICE.md
Last active February 12, 2021 18:23
ES6 Practice

ES6 Practice

Convert the following ES5 code to ES6.

Template Literals

// Template literals
var li = '<li>' +
  '<div class="row">' +
@deb1990
deb1990 / Readme.md
Last active February 20, 2021 21:11
SlashData

1. Prime Number

The 10001st Prime Number is 104743. Please find the code in primenumber.js file.

Technical Notes
  • In the code a cache is used to do the calculation more efficiently. When calculating the number for the 1st time, it takes around 23.35302734375ms, but if we run it again, it takes just 0.260986328125ms.
  • If next time we try to get the 10002nd prime number, The program will only calculate the 10002nd prime, because the previous 10001 numbers are already saved in the cache. This is again a huge performance benefit.

2. When would you choose a NoSQL database instead of a relational database and why?

  • In NoSQL each document can have its own unique structure. So when the schema of the data is not consistent and can change at any time, NoSQL is preferred. Its very flexible to add new kind of data without affecting existing data.
#!/bin/bash
# OPLOG_LIMIT: only include oplog entries before the provided Timestamp
# The timestamp is a unix timestamp
# If your desaster happened for example on 2017-18-10 12:20 and you want to restore until 12:19
# your timestamp is 'date -d "2017-10-18 12:19:00" +%s'
FULL_DUMP_DIRECTORY=$1
OPLOGS_DIRECTORY=$2
OPLOG_LIMIT=$3
@borekb
borekb / README.md
Last active August 10, 2022 14:14
Docker and Git Bash / MSYS2 on Windows: path conversion workaround

👋 Moved to https://github.com/borekb/docker-path-workaround


Docker in Git Bash / MSYS2 on Windows: path conversion workaround

UPDATE 07/2018: I switched from Git Bash to MSYS2 recently which should be very similar, if not the same, but there some subtle differences which made me realize this is more tricky than I thought and that I don't 100% understand what is going on. If someone can help, please let me know in the comments.

Invoking docker in MSYS2 shell or Git Bash typically fails with complains about paths, for example:

@LuisEnMarroquin
LuisEnMarroquin / .bash_profile
Last active September 15, 2022 21:50
My bash aliases and functions
#!/bin/bash
CL_NULL='\e[0m'
CL_FAIL='\e[0;31m'
CL_NICE='\e[0;32m'
CL_WARN='\e[0;33m'
CL_BLUE='\e[0;34m'
CL_PURP='\e[0;35m'
CL_CYAN='\e[0;36m'
@sjcotto
sjcotto / qrCode.js
Created May 5, 2016 20:07
Generate QR Code and save to mongodb
var json = {
email : "santiago@konacloud.io",
name : "Santiago Cotto"
};
var qr = require('qr-image');
var mongoose = require('mongoose');
var image = qr.imageSync(JSON.stringify(json), { type: 'png', size : 10 });
var Grid = require('gridfs');
@jeffrafter
jeffrafter / handler.js
Created April 2, 2010 20:59
Simple HTTP Server and Router in node.js
exports.createHandler = function (method) {
return new Handler(method);
}
Handler = function(method) {
this.process = function(req, res) {
params = null;
return method.apply(this, [req, res, params]);
}
}