Skip to content

Instantly share code, notes, and snippets.

View celleb's full-sized avatar
🏠
Working from home

Jon Manga celleb

🏠
Working from home
View GitHub Profile
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 March 11, 2020 09:34
Return a default value with a proxy
const prox = new Proxy({}, {
get: function (obj, prop) {
return obj.hasOwnProperty(prop)? object[prop]: 'default';
}
});
@celleb
celleb / DB.php
Last active August 29, 2015 14:13
This class can be used to access PDO statically and provides usefull methods to quickly access the database
<?php
/**
* Provides a way to call the PDO statically
* @author Jonas Tomanga <[email protected]>
* @version 2.0
*/
class DB {
/**
@celleb
celleb / aajquery.validate.additional-methods.js
Last active March 16, 2018 15:39
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/
(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 December 23, 2015 08:09
Fixes grid layout problems for zurb foundation 4 for internet explorer 8 and 7
/* 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