Skip to content

Instantly share code, notes, and snippets.

View Narshe1412's full-sized avatar
📚
On my way to something great!

Manuel Narshe1412

📚
On my way to something great!
View GitHub Profile
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using StackExchange.Redis;
using WebApp;
namespace ClassLib.CacheExtension
@Narshe1412
Narshe1412 / tasks.json
Created April 5, 2017 11:40 — forked from felixfbecker/tasks.json
VS Code Javac & JUnit tasks.json
/*
Example for quick Java compilation and unit tests in VS Code.
Works well with simple BlueJ projects.
Hit Ctrl+Shift+B to compile currently open file with javac.
Hit Ctrl+Shift+T to test currently open test class.
See red wiggles for compilation errors / failed assertions or click exclamation mark in the status bar.
Uses a few workarounds for individual commands per task and filename without extension.
This is written for Windows but it should be easy to adopt for Linux and Mac.
*/
{
// Bonfire: Roman Numeral Converter
// Author: @narshe1412
// Challenge: http://www.freecodecamp.com/challenges/bonfire-roman-numeral-converter
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function convert(number) {
if ((number < 0) || (number > 3999)) {alert("Please select a number between 1 and 3999");}
if (number >= 1000) return "M" + convert(number - 1000);
if (number >= 900) return "CM" + convert(number - 900);
if (number >= 500) return "D" + convert(number - 500);
// Bonfire: Diff Two Arrays
// Author: @narshe1412
// Challenge: http://www.freecodecamp.com/challenges/bonfire-diff-two-arrays
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function diff(arr1, arr2) {
var newArr = [];
// Same, same; but different.
for (i=0; i < arr1.length; i++){
if (arr2.indexOf(arr1[i]) < 0){
// Bonfire: Sum All Numbers in a Range
// Author: @narshe1412
// Challenge: http://www.freecodecamp.com/challenges/bonfire-sum-all-numbers-in-a-range
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function sumAll(arr) {
var max = Math.max(...arr);
var min = Math.min(...arr);
var fullArray = [];
for (var i = min; i <= max; i++) {
// Bonfire: Where do I belong
// Author: @narshe1412
// Challenge: http://www.freecodecamp.com/challenges/bonfire-where-do-i-belong#
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function where(arr, num) {
// Find my place in this sorted array.
var sortedArray = arr.sort(function(a,b){
return a-b;
});
// Bonfire: Seek and Destroy
// Author: @narshe1412
// Challenge: http://www.freecodecamp.com/challenges/bonfire-seek-and-destroy
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function destroyer(arr) {
// Remove all the values
var killerArray = Array.prototype.slice.call(arguments);
killerArray.splice(0,1);
var solution = arr.filter(function(val){
// Bonfire: Mutations
// Author: @narshe1412
// Challenge: http://www.freecodecamp.com/challenges/bonfire-mutations
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function mutation(arr) {
var strParent = arr[0].toLowerCase().split("");
// console.log("Parent string: "+strParent);
var strKey= arr[1].toLowerCase().split("");
// console.log("key string:"+strKey);
// Bonfire: Slasher Flick
// Author: @narshe1412
// Challenge: http://www.freecodecamp.com/challenges/bonfire-slasher-flick
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function slasher(arr, howMany) {
// it doesn't always pay to be first
arr.splice(0,howMany);
return arr;
}
// Bonfire: Chunky Monkey
// Author: @narshe1412
// Challenge: http://www.freecodecamp.com/challenges/bonfire-chunky-monkey
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function chunk(arr, size) {
// Break it up.
var result = [];
var innerArray = [];
for (var i=0; i<arr.length; i+=size) {