Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,165,013 members, 7,859,628 topics. Date: Thursday, 13 June 2024 at 03:49 PM

Kodejuice's Posts

Nairaland Forum / Kodejuice's Profile / Kodejuice's Posts

(1) (2) (3) (4) (of 4 pages)

Programming / Re: Check Out This New Forum I Installed. Like Nairaland++ by Kodejuice: 5:16pm On Jan 06, 2018
Just trolling

Programming / _ by Kodejuice: 8:11am On Nov 02, 2017
_
Programming / Re: Challenge For Javascript Beginners/intermidiate by Kodejuice: 8:23pm On Sep 20, 2017
Jaddo19:
Lemme drop this simple one so beginners can participate.
.
Challenge 3.

Write a function that works just like console.log


console.log = (...a) => console.error(...a);


LoL smiley

1 Like

Programming / Re: Coding Challenge For Fun by Kodejuice: 4:51am On Aug 14, 2017
O(N) time

JS

let input = "aA11";
let [o, n, c] = [{}, {}, 0];
input = input.toLowerCase();
for (let i = 0, ch; i < input.length; i += 1) {
ch = input[i];
if (o[ch] && !n[ch]) {
c += 1;
n[ch] = 1;
} else o[ch] = 1;
}

console.log(c); // => count

1 Like

Programming / Re: QUIZ: How Many Lines Of Code Can You Use To Reverse A List by Kodejuice: 8:25am On Jun 08, 2017


//JS 1 Line wink

1. list=[1, 2, 3],
console.log( rev = list.reduce((x, y, i)=>x.concat(list[list.length - i - 1]), []) );

Programming / Re: QUIZ: How Many Lines Of Code Can You Use To Reverse A List by Kodejuice: 9:52am On Jun 07, 2017
JavaScript


// 2 Lines

1. let list = [1, 2, 3];
2. for (var d=0, rev=[];d<list.length;d++)
rev[rev.length] = list[list.length - d - 1];

console.log(rev);

---------------------

// 1 Line smiley

1. var list=[1, 2, 3],
rev = list.reduce((x, y, i)=>x.concat(list[list.length - i - 1]), []);

console.log(rev);

Romance / Re: New Nairaland App For Android Devices by Kodejuice: 3:45pm On Jun 05, 2017
Sugarcious:
Suen come o! Somebody dey gossip u
Seun ?, who's he grin grin
Romance / New Nairaland App For Android Devices by Kodejuice: 1:56pm On Jun 05, 2017
ScreenShots of the app below
This app gives you access to all Nairalands features.

Download Link => CLick to Download New NairaLand App

Forum Games / New Nairaland App For Android Devices by Kodejuice: 1:48pm On Jun 05, 2017
ScreenShots of the app below
This app gives you access to all Nairalands features.

Download Link => CLick to Download New NairaLand App

Blog Post => https://kodejuice./2016/12/27/a-nairaland-app-i-built-for-android-and-iphone/

Fashion / New Nairaland App For Android Devices by Kodejuice: 1:42pm On Jun 05, 2017
ScreenShots of the app below
This app gives you access to all Nairalands features.

Download Link => CLick to Download New NairaLand App

Programming / Re: Localgoogle - A Local Search Engine by Kodejuice: 12:20pm On Jun 04, 2017
nijabazaar:
Can you explain how the Search engine works....to a semi novice.

What makes it better than the existing systems?

Or what could still be worked on?

Its not a search engine that 'everybody' can use, its only meant for people that make use of the offline version of websites.

Some people arent always connected to the internet, so whenevet they desperately need info from a particular website and they happen to have the offline version of that website on their local machine...they could use localGoogle to find the info they need, rather than manually going to the site directly
Programming / Localgoogle - A Local Search Engine by Kodejuice: 8:47pm On Jun 03, 2017
Hey Guys, i just published localGoogle on github, a search engine that helps you get information easily from your offline websites.

A very helpful tool for devs that have the offline version of websites like (W3Schools, MDN, PHP.net, ...) on their machine, with localGoogle, you easily get what you need from these offline websites without having to go through them manually.

localGoogle on github

1 Like

Forum Games / Re: Can You Solve This "Simple" Quiz? by Kodejuice: 12:55pm On Apr 04, 2017
Deeypeey:

i understand ur anger...mathematics frustrated u as a child..and worse,u still dnt knw it...sorry bro
bun serously,its a Tuesday
I'm well versed in mathematics to tell you that what you did is the most useless thing i've seen, wtf are u prooving? y+1? x-1? for where? who taught you mathematics? i can bet you dont even know maths undecided

1 Like 1 Share

Forum Games / Re: Can You Solve This "Simple" Quiz? by Kodejuice: 5:22pm On Apr 01, 2017
Deeypeey:
He said it on a Tuesday
Proof
now imagine this....Tuesday's yesterday is monday
monday is sunday's tommorrow
let tuesday be x...let sunday be y
X-1 = monday
buh if today is sunday,then tommorow will be Monday i.e y+1 = Monday
therefore x-1 = y+1 = monday
.
.
hence its bn proven today is Tuesday

Rubbish! nonsense proof, it was on a Friday , its logical English not mathematics WTF angry
Programming / Re: Which Nigeria University Are Good For Computer Science?? by Kodejuice: 7:33pm On Jan 02, 2017
What about Good schools for Computer Engineering
Programming / Re: Math/programming Puzzle - Finding All Expressions That Evaluates To Some Value by Kodejuice: 3:21am On Dec 30, 2016
Jolliano:


Must the four numbers be used?

If yes, here's my answer on python 2.7

from __future__ import division

numbers=[1,3,4,6]
result = int(numbers[3] / (numbers[0] - (numbers[1] / numbers[2])))
print(result)

LoL, BULLCRAP... This is not a solution.
SHow the code that computed the value '6/(1-(3/4))'

2 Likes

Programming / Re: Math/programming Puzzle - Finding All Expressions That Evaluates To Some Value by Kodejuice: 4:41am On Dec 29, 2016
paranorman:
You mean the statement to executed should only contain unique operands(the numbers) that cannot be repeated, but the set (1, 3, 4, 6) may not be exhausted. You may use all operators, combine or just a single one?

You may combine the operators, but use the numbers once
Programming / Re: Math/programming Puzzle - Finding All Expressions That Evaluates To Some Value by Kodejuice: 1:19pm On Dec 28, 2016
FrankLampard:
My Brute force approach, would be to loop through all the number, then check which if the operators would sum to 24.

Talk's cheap, show us code

1 Like

Programming / New NL App For Android And IOS by Kodejuice: 7:17pm On Dec 27, 2016
For some reasons i cant post the stuff here, cause that bot will catch and ban me for i reason i do not know , so i created a wordpress blog post with the stuffs there https://kodejuice./2016/12/27/a-nairaland-app-i-built-for-android-and-iphone/
Programming / Re: A Little Javascript Problem by Kodejuice: 7:16pm On Dec 27, 2016
Programming / Re: A Little Javascript Problem by Kodejuice: 7:09pm On Dec 27, 2016
paranorman:

Hahahahaha, I pray so Bros. I am still a rookie sha.

the op was going on about using range, functions bla, bla, bla...

I just solved his problem using a single function, the second function wasn't even necessary.

Your solution is OOP (Out Of Point)
undecided

1 Like

Programming / Math/programming Puzzle - Finding All Expressions That Evaluates To Some Value by Kodejuice: 7:03pm On Dec 27, 2016
(it was given at a math contest for ten year olds and apparently many math teachers couldn't figure out a solution):

We have numbers 1, 3, 4 and 6. Create an expression using any elementary operators (+, -, *, /), containing only these numbers, exactly once each, such that the result is 24, you can also include parens ( and ).

I felt the problem itself is inappropriate for 10 y.o. kids and irrelevant for a maths contest; but it seemed like a good programming exercise

So come up with a program to give the solution(s).

Use any Language you feel comfortable with
Programming / Re: A Little Javascript Problem by Kodejuice: 4:25pm On Dec 26, 2016
stack1:
...So this is version 2, i removed all but one dot operator, i couldn't find an alternative for the
last dot operator in the foreach function so..
(and i know, the with operator feels like a cheat)


function range(start, end) {

var result = String(start);
while (start < end)
result += "," + String(++start);

with (result) {
return split("," );
}


}
function map(arr, func) {
var l, m, n, o;

with (arr) {
l = length;
var temp = slice(0, l);//make a local copy

//clear out the original array
while (length)
shift();
}

m = 0;
while ((m++) !== l) {
with (temp) {
n = shift();
}
o = func(n);
with (arr) {
push(o);
}
}
return arr;
}
function reverse(arr) {
with(arr) return reverse();
}
function foreach(arr, func) {
var current, i=0,l;

with(arr){
l = length;
}
while ( (i++) !== l){

with(arr){
current = shift();
}
func.bind(console)(current);
}

}


LoL, u try sha, anyway heres my solution


// helper functions
function cons(x, y) {
return function(f) { return f(x, y) };
}

function car(pair) {
return pair(function(x, y){ return x });
}

function cdr(pair) {
return pair(function(x, y){ return y });
}

function nil(f) {
return f(nil, nil);
}

// ....
function range(start, stop) {
return start <= stop ? cons(start, range(start + 1, stop)) : nil;
}

function map(list, func) {
return list === nil ? nil : cons(func(car(list)), map(cdr(list), func));
}

function foreach(list, func) {
if (list !== nil) {
func(car(list));
foreach(cdr(list), func);
}
}

function reverse(list) {
return (function rev(list, ret){
return list === nil ? ret : rev(cdr(list), cons(car(list), ret));
})(list, nil);
}

1 Like

Programming / Re: A Little Javascript Problem by Kodejuice: 4:17pm On Dec 26, 2016
paranorman:
i did PHP, using a recursive function, Mr. kodejuice
function jarvis(&$i, &$j, &$count) {
//$j = 10, by default, equivalent to the max number
//of the range;

$rand = rand(1, 10);
if ($j > 0) {
//is the first instance of the generated random number = 10 ? (print the number) : (keep looping through);
if (($rand == max(range(1, 10))) && ($count == 0)) {
print pow($rand, 2) . '<br />';
$j--;
$i = $rand;
$count++;
jarvis($i, $j, $count);
} else if ($rand == $j) {
//check if it's the next instance whose product
//should be printed; is instance consecutive?

print pow($rand, 2) . '<br />';
$j--;
$i = $rand;
jarvis($i, $j, $count);
} else {
//keep loopin through if the nth instance is not consecutive
//wrt to the previous

jarvis($i, $j, $count);
}
}
}

function ironMan() {
$i = 0;
$j = 10;
$count = 0;
//the $i parameter is not necessary, just included in function construct in case
//you wanna track the random number

jarvis($i, $j, $count);
}
ironMan();

(WTF)

1 Like 1 Share

Programming / Re: A Little Javascript Problem by Kodejuice: 3:33pm On Dec 25, 2016
godofbrowser:



var range = Array.from(Array(11).keys());

Array.shift(range);
var numbers = Array.reverse(Array.map(range, function(value){
return value * value;
}));

Array.forEach(numbers, logNumbers);

function logNumbers(v){
console.log(v);
}


Does this fit into your desired solution?

Note: i have tried to avoid using a "new Array" or the square brackets "[]" array declaration. I have also tried not to use the "numbers" var as an object which i know it is (everything in js is an object).

LoL, ur solution violates the rules,
1. You used the dot character
2. define the functions and not Array.wareva
Programming / A Little Javascript Problem by Kodejuice: 7:10pm On Dec 24, 2016
Found this online, and it looks so impossible but its very much possible......so if you think youre a JavaScript Baddass/Ninja or wareva, here's the chance to prove urself right.


In fact, this isn't about JavaScript, but that's the context I've discussed it in. I encourage you to think about it in more programming languages. (are there languages in which this can't be done?)

The problem: define functions range, map, reverse and foreach, obeying the restrictions below, such that the following program works properly. It prints the squares of numbers from 1 to 10, in reverse order.

var numbers = range(1, 10);
numbers = map(numbers, function (n) { return n * n });
numbers = reverse(numbers);
foreach(numbers, console.log);

/* output:

100
81
64
49
36
25
16
9
4
1
*/

Restrictions

You must not use arrays. The square bracket characters, [ and ], are forbidden, as well as new Array.

You must not use objects. The curly braces, { and }, and the dot character (.) are forbidden. You may use curly braces for code blocks, but not for creating JavaScript objects.

Should go without saying, these functions must be generic and do what their name implies. They must not be hard-coded for the particular 1..10 example.

Feel free to define utilities; you don't have to restrict your program to these 4 functions. It does not matter how fast, small or elegant it is — if you can do it within the limitations above, I think you're an above-average programmer.

(1) (2) (3) (4) (of 4 pages)

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 37
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.