Skip to content

Instantly share code, notes, and snippets.

Avatar

Jonas Tomanga Celleb

View GitHub Profile
View score-colors-proxy.js
const defaultColor = 'GREEN';
const colors = {
0: 'RED',
1: 'PINK',
2: 'PURPLE'
};
const scoreColors = new Proxy(colors, {
get: function (obj, prop) {
return obj.hasOwnProperty(prop) ? object[prop] : defaultColor;
@Celleb
Celleb / proxy.js
Created Mar 11, 2020
Return a default value with a proxy
View proxy.js
const prox = new Proxy({}, {
get: function (obj, prop) {
return obj.hasOwnProperty(prop)? object[prop]: 'default';
}
});
@Celleb
Celleb / DB.php
Last active Aug 29, 2015
This class can be used to access PDO statically and provides usefull methods to quickly access the database
View DB.php
<?php
/**
* Provides a way to call the PDO statically
* @author Jonas Tomanga <jonas@modus.com.na>
* @version 2.0
*/
class DB {
/**
@Celleb
Celleb / aajquery.validate.additional-methods.js
Last active Mar 16, 2018
Additional methods for jquery.validate.js plugin. Adds functionality to match to input elements ie. Password and confirm password. Look up functionality - to lookup if the entered info is in the database i.e codes etc. Duplicates - to lookup for duplicates in the database. You need the jquery validation plugin from http://jqueryvalidation.org/
View aajquery.validate.additional-methods.js
(function() {
/* This method is to match two input elements */
jQuery.validator.addMethod("match", function(value, element, options) {
if (value === $(options).val()) {
return true;
} else {
return false;
}
@Celleb
Celleb / _columnfix.scss
Last active Dec 23, 2015
Fixes grid layout problems for zurb foundation 4 for internet explorer 8 and 7
View _columnfix.scss
/* zurb foundation 4 grid column fix for ie8 and below */
@mixin columnFix($columns: 12){
$i: 1;
@while $i < $columns + 1 {
$colWidth: ($i/$columns)*100%;
$colWidth7: ($i/$columns)*98%;
& .large-#{$i}, & .small-#{$i} {
width: $colWidth;
*width: $colWidth7; //sets the width for ie7
You can’t perform that action at this time.