Skip to content

Instantly share code, notes, and snippets.

View jochri3's full-sized avatar

Christian Lisangola jochri3

View GitHub Profile
@jochri3
jochri3 / HaJU-46.js
Created September 3, 2017 16:24
null created by anonymous - https://repl.it/HaJU/46
// Write a function that will take a string as input, and return a new
// string with the same letters in reverse order.
//
//
// Difficulty: easy.
function reverse(string) {
var reversed=""
for(var i=string.length-1;i>=0;i--)
{
@jochri3
jochri3 / HaJO-61.js
Created September 3, 2017 16:29
null created by ChrisLis - https://repl.it/HaJO/61
// Write a function that takes an integer `n` in; it should return
// n*(n-1)*(n-2)*...*2*1. Assume n >= 0.
//
// As a special case, `factorial(0) == 1`.
//
// Difficulty: easy.
function factorial(n) {
var fact=1
if(n==0)
@jochri3
jochri3 / H7HZ-49.js
Created September 3, 2017 17:05
null created by ChrisLis - https://repl.it/H7HZ/49
// Write a method that takes in a string. Return the longest word in
// the string. You may assume that the string contains only letters and
// spaces.
//
// You may use the String `split` method to aid you in your quest.
//
// Difficulty: easy.
function longest_word(sentence) {
var phrase=sentence.split(" ")
@jochri3
jochri3 / HaIs-29.js
Created September 3, 2017 17:12
null created by ChrisLis - https://repl.it/HaIs/29
// Write a function that takes in an integer `num` and returns the sum of
// all integers between zero and num, up to and including `num`.
//
// Difficulty: easy.
function sum_nums(num) {
var sum=0;
for(var i=1;i<=num;i++)
{
sum +=i
@jochri3
jochri3 / HaJg-106.js
Created September 3, 2017 17:31
null created by ChrisLis - https://repl.it/HaJg/106
// Write a function that will take in a number of minutes, and returns a
// string that formats the number into `hours:minutes`.
//
// Difficulty: easy.
function time_conversion(minutes)
{
if(minutes<60)return "0:"+minutes
else if(minutes==60)return "1:00"
else
@jochri3
jochri3 / HaK8-30.js
Created September 3, 2017 17:45
null created by ChrisLis - https://repl.it/HaK8/30
// Write a function that takes a string and returns the number of vowels
// in the string. You may assume that all the letters are lower cased.
// You can treat "y" as a consonant.
//
// Difficulty: easy.
function count_vowels(string)
{
var nbr_voyelles=0;
var list_voyelles="aeiouyAEIOUY"
@jochri3
jochri3 / HaKw-34.js
Created September 3, 2017 17:58
null created by ChrisLis - https://repl.it/HaKw/34
// Write a function that takes a string and returns true if it is a
// palindrome. A palindrome is a string that is the same whether written
// backward or forward. Assume that there are no spaces; only lowercase
// letters will be given.
//
// Difficulty: easy.
function is_palindrome(string) {
var contraire=string.split("").reverse().join("");
if(contraire==string)
@jochri3
jochri3 / HaLe-31.js
Created September 13, 2017 00:33
null created by ChrisLis - https://repl.it/HaLe/31
// Write a function that takes a string in and returns true if the letter
// "z" appears within three letters **after** an "a". You may assume
// that the string contains only lowercase letters.
//
// Difficulty: medium.
function nearby_az(string) {
var str=string
var tb=[]
for(var i in str)
@jochri3
jochri3 / variousCountryListFormats.js
Created May 15, 2020 12:05 — forked from incredimike/variousCountryListFormats.js
Country list as javascript array (alphabetical)
// Lists of countries with ISO 3166 codes, presented in various formats.
// Last Updated: Nov 15, 2019
// If you're using PHP, I suggest checking out:
// https://github.com/thephpleague/iso3166
//
// JS developers can check out:
// https://www.npmjs.com/package/iso3166-2-db
// List of all countries in a simple list / array.
@jochri3
jochri3 / node-folder-structure-options.md
Created August 27, 2020 19:39 — forked from lancejpollard/node-folder-structure-options.md
What is your folder-structure preference for a large-scale Node.js project?

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin