View gist:16e924b12db269ccd2b41963452f7089
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Andela: | |
fellows = 'top .5 percent in Nigeria' | |
fellow_list = [1,2,3,4,5] | |
@staticmethod | |
def say_the_chant(): | |
print "Andela Aww Yea!!!!" | |
View gist:76f783d02949c03c2d45d2d6c3a226ba
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Singleton: | |
the_actual_instance = None | |
class _Singleton: | |
""" | |
The actual implementation of the Singleton class should reside here | |
""" | |
def __init__(self): | |
self.required_attribute = 'mayor' | |
print('this should only be printed once.. i.e this class should only be instantiated once.') |
View power-recursive.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def power(a,b): | |
if b == 0: | |
return 1 | |
elif a == 0: | |
return 0 | |
else: | |
return a * power(a,b-1) |
View factorial-recursive.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def factorial(num): | |
if num == 0: | |
return 1 | |
else: | |
return num * factorial(num - 1) |
View power-recursive.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function power(a,b){ | |
if (b === 0){ | |
return 1 | |
} | |
else if (a === 0){ | |
return 0 | |
} | |
else{ | |
return a * power(a,b-1) | |
} |
View recursion.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function factorial( n ) { | |
if ( n === 1 ) { | |
return 1; | |
} | |
return n * factorial( n - 1 ); | |
} |
View FIlter_OBJECTS.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Human { | |
constructor(name, id){ | |
this.name = name; | |
this.id = id; | |
} | |
} | |
one = new Human('bolaji',1); | |
two = new Human('murphy', 1); | |
three = new Human('anu',3); |
View ES5 Classes.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// class | |
var Person = function(name, gender) { | |
this.name = name; | |
this.gender = gender; | |
this.legs = 2; | |
} | |
Person.prototype.getName = function () { | |
return this.name; | |
} |
View sample_array.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sample_array = ['Bolaji','Damilola','Ichiato','Oladipupo','Koya','Mumeen'] | |
# I want to cycle through the array an check if an element is there. | |
# Here i want to see if 'Bolaji' is in the sample_array | |
def name_exists(name): | |
for element in sample_array: | |
if element == name: | |
print("Bolaji Exists") |
View dispatch.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import PropTypes from "prop-types"; | |
import {connect} from "react-redux"; | |
import * as courseActions from "../../actions/courseAction"; | |
class CoursesPage extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { |
OlderNewer