Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am andela-mfalade on github.
  • I am mayor (https://keybase.io/mayor) on keybase.
  • I have a public key whose fingerprint is 1AA1 A07E 9457 CB44 88AA F45C E5BC DE71 DBB8 9BD6

To claim this, I am signing this object:

angular.module('cerqma.services')
.factory('Equipments', ['$http', '$rootScope', '$state',
'API_PREFIX',
function ($http, $rootScope, $q, $state, API_PREFIX) {
// Response Handler
function returnResponse(res) {
return res.data;
}
function all(filter) {
(function( $ ){
$.fn.formalize = function(options){
var settings = $.extend({
section: 'fieldset',
wrapper: '.form-section',
navType: 'section',
prevNav: '.form-nav-prev',
nextNav: '.form-nav-next',
timing: 0,
nextCallback: null,
class Singleton:
the_actual_instance = None
class _Singleton:
def __init__(self):
self.name = 'mayor'
print('this should only be printed once.. i.e this class should only be instantiated once.')
def create_room(self, room_name):
print 'I see you are trying to create a new room ', room_name
@mfalade
mfalade / Singleton.py
Last active February 23, 2017 15:29
A simple illustration of the Singleton pattern in Python
class Singleton:
the_actual_instance = None
class _Singleton:
"""
The actual implementation of the Singleton class should reside here
"""
def __init__(self):
self.name = 'mayor'
print('this should only be printed once.. i.e this class should only be instantiated once.')
@mfalade
mfalade / getattr.py
Created February 23, 2017 10:52
A simple illustration of the class __getattr__ method
class Andela:
fellows = 'top .5 percent in Nigeria'
fellow_list = [1,2,3,4,5]
@staticmethod
def say_the_chant():
print "Andela Aww Yea!!!!"
@mfalade
mfalade / getattr.py
Created February 23, 2017 10:53
A simple illustration of the class __getattr__ method
class Andela:
fellows = 'top .5 percent in Nigeria'
fellow_list = [1,2,3,4,5]
@staticmethod
def say_the_chant():
print "Andela Aww Yea!!!!"
@mfalade
mfalade / foobar.js
Last active September 8, 2018 06:11
Foo Bar: A playful attempt to implement the common foobar problem, using HOFs; without having to do an explicit check for the value `15`, nor `n % 3 === 0 && n % 5 === 0`
function getLabelForValue(n) {
return function(divisor) {
var labelMapping = {
3: 'foo',
5: 'bar'
};
if (n && n % divisor === 0 ) {
return labelMapping[divisor];
}
return null;
@mfalade
mfalade / csv-reader.js
Created March 26, 2018 08:10
CSV reader
function csv(text) {
var p = '', row = [''], ret = [row], i = 0, r = 0, s = !0, l;
for (l in text) {
l = text[l];
if ('"' === l) {
if (s && l === p) row[i] += l;
s = !s;
} else if (',' === l && s) l = row[++i] = '';
else if ('\n' === l && s) {
if ('\r' === p) row[i] = row[i].slice(0, -1);
@mfalade
mfalade / db-fields.yml
Last active July 23, 2018 11:49
Yasmine's project fields
#### Models
user:
fields:
id:
type: string
required: true
requestType:
type: string
enum: [first-user, new-user, client-vip]
required: true