₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,914 members, 8,424,154 topics. Date: Wednesday, 10 June 2026 at 06:58 PM

Toggle theme

Cybergenius's Posts

Nairaland ForumCybergenius's ProfileCybergenius's Posts

1 2 (of 2 pages)

ProgrammingRe: Code Wrestling Entertainment: Sharpen Ur Skill!!! by Cybergenius(m): 5:48pm On May 12, 2015
Code challenge 2: Write a program to print out pascal triangle
| | | | 2 | | 3 3 | | 4 6 4 |
My try with JavaScript:
 function pascalTriangle(rows) {
var triangle, tier;
triangle = [[1*1]]; for (i = 0; i < (rows-1); i+=1) { tier = [1]; for (var k = 1; k < triangle[i].length; k++) { tier[k] = triangle[i][k] + triangle[i][k-1]; } tier.push(1); triangle.push(tier); } return triangle; }
ProgrammingMobile App Developer VS Web Developer VS Software Developer by Cybergenius(op): 5:47pm On Feb 20, 2015
Just want to know which of them is better and more profitable in nigeria, Replies Please.
ProgrammingRe: To All Programmers, Today Is My Birthday! by Cybergenius(m): 8:14pm On Jan 16, 2015
<?php

echo "Happy Birthday bro";

?>
ProgrammingTictactoe Game With Javascript by Cybergenius(op): 4:07pm On Jan 16, 2015
Check out the awesome Tictactoe game popularly know as X and O in Nigeria, built with JavaScript, with a very powerful AI, http://kodejuice.tk/game.html
ProgrammingRe: Lets Solve Some Javascript Problems by Cybergenius(m): 12:21pm On Dec 13, 2014
//tested and trusted

function singleArr(arr){
var ret = [], arr = arr;

for(i=0;i<arr.length;i++){
//if the item is an array
if(arr[i] instanceof Array){
//loop through and add it to the 'ret' array variable
for(c=0;c<arr[i].length;c++) ret.push(arr[i][c]);
} else ret.push(arr[i]);
}
return ret;
}

console.log( singleArr([0,[1,2,3,4],5,[6,7,8,9],10,"end"]) ); //[0,1,2,3,4,5,6,"end"]
ProgrammingRe: ATTENTION: Programming Logic Comparison by Cybergenius(m): 6:02pm On Nov 13, 2014
No difference, they are both the same
ProgrammingRe: The 3 Types Of Developers You Will Find In Africa. Which 1 Are You? by Cybergenius(m): 4:43pm On Nov 06, 2014
i fall under the Idi amin developer
ProgrammingRe: Free Web Hosting And Domain Websites by Cybergenius(m): 6:36am On Nov 06, 2014
http://heliohost.org, supports - python,ruby,java,php,perl and so on.. For freee!!!
ProgrammingRe: I Bet You Cant Do This With Javascript, *check Out* by Cybergenius(op): 5:04pm On Nov 04, 2014
ProgrammingRe: I Bet You Cant Do This With Javascript, *check Out* by Cybergenius(op): 5:38pm On Nov 03, 2014
blueyedgeek:
Oh, I'm supposed to set a variable equal to the result of calling the identify function. Why do I need to call it like a function?
thats the challenge
ProgrammingRe: I Bet You Cant Do This With Javascript, *check Out* by Cybergenius(op): 5:36am On Nov 02, 2014
blueyedgeek:
This should be pretty easy to implement.

function identify(val){
this.val = val;
return val;
}
identify(3) --> 3
identify("Tunde" ) --> "Tunde"
identify({name: "Osewa"}) --> Object {name: "Osewa"}

you are wrong you didn't follow the rule, where is the idf variable?

function identify(q){
return function(){
return q;
}
}

idf = identify(3);
idf() //3
ProgrammingRe: I Bet You Cant Do This With Javascript, *check Out* by Cybergenius(op):
My attempt

function identify(q){
return q;
}

idf = identify(2);

idf() //"TypeError: 2(value of expression idf) is not object"
ProgrammingI Bet You Cant Do This With Javascript, *check Out* by Cybergenius(op): 4:01pm On Nov 01, 2014
Lets see how you know javascript!
--
Write a function that takes an argument and returns that argument

idf = identify(3);
idf() //3
ProgrammingRe: How Can I Generate Phone Numbers by Cybergenius(m):
<script>
function no(q){
var rand = Math.floor(Math.random()*6);
var numbers = [];

function r(){
return arguments[Math.floor(Math.random()*arguments.length)];
}

var q = (q)?q:2;
for(i=0;i<q;i++){
numbers.push(r("080","070","081","090"wink+r("0","1","2","3","4","5","6","7","8","9"wink+r("0","1","2","3","4","5","6","7","8","9"wink+r("0","1","2","3","4","5","6","7","8","9"wink+r("0","1","2","3","4","5","6","7","8","9"wink+r("0","1","2","3","4","5","6","7","8","9"wink+r("0","1","2","3","4","5","6","7","8","9"wink+r("0","1","2","3","4","5","6","7","8","9"wink+r("0","1","2","3","4","5","6","7","8","9"wink);

alert(numbers[i].replace(/[,]/ig,""wink);
}

//array "number" now contains 3 mobile numbers or amount of arguments passed in.

}

no(4);
//08035690651
//08152360846
//07056367416
//08035690651
</script>
ComputersRe: Africans Expecially Nigeria Are Not Exposed To Technology by Cybergenius(m): 5:59pm On Oct 26, 2014
True Talk
ProgrammingRe: Please I Need Help - Evaluating A Javascript Code Line By Line by Cybergenius(op): 5:33pm On Oct 26, 2014
The above code is meant to compile my code in a script tag
with an id of "#val", if i read the code by line, it wont work out, cause it would also read "while(!i){" as a code on its own, my question is - How do i read that particular block of code

while(!i){
var i = jQuery;
}


read this as whole and not by line
ProgrammingPlease I Need Help - Evaluating A Javascript Code Line By Line by Cybergenius(op): 5:30pm On Oct 26, 2014
I have this html/javascript +jquery code, which is meant to
compile my code, but i dont know how to read the
javascript as a code.

//the code
<!DOCTYPE html>
<html>
<head>
<script src="jquery.js"></script>
<script async>
window["logerrors"] = function(){

var script = $("script#val"wink.text().replace(/[\n]/ig,"};"wink;
var reps = script.replace(/};/ig,"~"wink;
var eachLine = reps.split("~"wink;
var errors ="";
var err = [];

for($i=0;$i<eachLine.length;$i++){
try{
new Function(eachLine[$i])();
err.push("no"wink;
continue;
} catch(e){
errors += "Scope Number: "+ Number($i+1) +"<br>"+e +
"<br><span style='color:red;white-space: pre'>"+eachLine
[$i]+"</span><hr>";
err.push("yes"wink;
continue;
}
}

if(err.indexOf("yes"wink > -1){
$("body"wink.html(errors);
} else{
return true;
}

}
</script>
</head>
<body onLoad="logerrors()">
<script id="val">
var i = jQuery;
while(!i){
var i = jQuery;
}
phrompt(i.fn.jquery);
ro(q);

//the while loop is an example, the code reads it as "while(!i){"
</script>
</body>
</html>
ProgrammingRe: Jquery Progress Bar Plugin by Cybergenius(op): 5:00pm On Oct 10, 2014
Please i need your feedbacks
ProgrammingJquery Progress Bar Plugin by Cybergenius(op): 11:00am On Oct 10, 2014
just built a progress bar plugin with jQuery, check it at - http://digbar.ml
ProgrammingRe: Javascript Study Group by Cybergenius(m): 9:52am On Oct 04, 2014
blueyedgeek:
How can you use jQuery without linking to it first? Your code no work and as such this thread remains open.
just joking *JERK*
ProgrammingRe: XML For Web Development by Cybergenius(op): 5:33am On Sep 30, 2014
$(this).thread().find("olucurious"wink.hide().end().close();
ProgrammingXML For Web Development by Cybergenius(op):
OBSOLETE
ProgrammingRe: Javascript Study Group by Cybergenius(m): 12:04am On Sep 26, 2014
<script>
$(this).thread().close(true);
</script>
ProgrammingRe: Face Recognition by Cybergenius(m): 12:11pm On Sep 04, 2014
ProgrammingRe: Why Now Is The Best Time To Learn Javascript by Cybergenius(m): 7:37am On Sep 04, 2014
ProgrammingHashtag Highlighting Like Twitter With Javascript by Cybergenius(op): 11:25pm On Aug 27, 2014
Hey folks i need your help. I would
like to know how to select the hashtags from a text with JavaScript (ex.
#hash) and then apply a html link to the hashtag as follows...
"DEMO":
some text...<a class="hashtag"
href="http://example.com?h=hash">#hash</a>
.
I tried something like this ->
"DEMO":
<script>
var text = "this is some text #foo with some hashtags";
text.replace(/#\w*[a-zA-Z]+\w*/ig,"hashtag name with html link"wink;
document.write(text);
</script>

this selects the hashtags, but how do i make the hashtag an html link. Thank you

1 2 (of 2 pages)