Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Samson Iyanda samcyn

🎯
Focusing
Block or report user

Report or block samcyn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@samcyn
samcyn / solution.js
Last active Nov 5, 2019
FLAT A LIST(ARRAY) USING JAVASCRIPT
View solution.js
/*
A - S I M P L E - F L A T - L I S T - H A N D L E R
- U S I N G - F L A T
*/
const flatListHandler = (nestedArray, depth) => {
return nestedArray.flat(depth);
}
// U S A G E -
const nestedArray = [1, 2, 3 ,4 , [5, 6, 7], 8];
@samcyn
samcyn / flatten.js
Created Dec 19, 2018
Flattening arrays
View flatten.js
var givenArray = [1,2,[3,4,5], 6, [7,8]];
function flattenController(arr) {
return arr.reduce(function (flat, toFlatten) {
return flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten);
}, []);
}
flattenController(givenArray); // [1, 2, 3, 4, 5, 6, 7, 8];
View jsbin.kisodag.js
var button = document.querySelector('button');
Rx.Observable.fromEvent(button, 'click')
.throttleTime(1000)
.map( (data) => { return data.clientY })
.subscribe(
(coordinate) => console.log(coordinate)
);
@samcyn
samcyn / eye.html
Created Nov 3, 2017
Eye animation. 3rd day 30 days challenge.
View eye.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
body{
height: 100vh;
@samcyn
samcyn / cuboid.html
Last active Nov 2, 2017
A match box loader. Day2 30 days challenge
View cuboid.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.stage {
position: absolute;
@samcyn
samcyn / mat.html
Last active Nov 1, 2017
A simple mat. 30Days CSS challenge.. DAY1 challenge
View mat.html
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
body{
background: #EEE;
height: 100vh;
@samcyn
samcyn / sorting.js
Created Feb 26, 2017
Sorting arrays of Objects
View sorting.js
const footballers = [
{
name: "Rooney",
age: 30
},
{
name: "Ronaldo",
age: 32
},
{
You can’t perform that action at this time.