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 for creating multi inheritance. | |
class multi { | |
// Inherit method to create base classes. | |
static inherit(..._bases) { | |
class classes { | |
// The base classes | |
get base() { | |
return _bases; | |
} |
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
/* | |
* Get nested object property using dot notation | |
* */ | |
const getProperty = ( propertyName, object ) => { | |
let parts = propertyName.split( "." ), | |
length = parts.length, | |
i, | |
property = object || this; |
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
/* | |
* Set nested object properties using dot notation with value | |
* */ | |
const setNested = (obj, path, val) => { | |
const keys = path.split('.'); | |
const lastKey = keys.pop(); | |
const lastObj = keys.reduce((obj, key) => | |
obj[key] = obj[key] || {}, | |
obj); |
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
/* | |
* return obj with the field, used in mostly map() | |
* @param x {Object} | |
* @param fields {Array} | |
* @returns {Object[]} | |
* | |
* Sample Usage | |
* const returnFields = ['amount', 'created', 'status']; | |
* ArrayObjects.map(x => returnObj(x, returnFields)); | |
* |
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
# just an example of how the `timeit` works | |
# below is an example of class attribute vs method parameter performance | |
class CircleTime(): | |
def __init__(self, radius=1): | |
self.pi = 3.14 | |
self.radius = 1 | |
# use class attribute pi | |
def get_circum_self(self): |
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
$(document).mouseup(function(e){ | |
var _con = $('.signUp-LogIn-form'); | |
if(!_con.is(e.target) && _con.has(e.target).length === 0){ | |
$('.signUp-LogIn-form').hide(); | |
} | |
}); |
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(){ | |
/* | |
Inputs need a comma in between each value don't put quotations (line break is allowed) | |
Example inputs | |
A, | |
B, | |
C | |
*/ | |
//When submit |
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 getAllElementsWithAttribute(attribute) | |
{ | |
var matchingElements = []; | |
var allElements = document.getElementsByTagName('*'); | |
for (var i = 0, n = allElements.length; i < n; i++) | |
{ | |
if (allElements[i].getAttribute(attribute) !== null) | |
{ | |
// Element exists with attribute. Add to array. | |
matchingElements.push(allElements[i]); |
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 getQueryVariable(variable) | |
{ | |
var query = window.location.search.substring(1); | |
var vars = query.split("&"); | |
for (var i=0;i<vars.length;i++) { | |
var pair = vars[i].split("="); | |
if(pair[0] == variable){return pair[1];} | |
} | |
return(false); | |
} |
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
Show hidden characters
{ | |
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", | |
"folder_exclude_patterns": | |
[ | |
".svn", | |
".hg", | |
"CVS" | |
], | |
"font_size": 9.0, | |
"ignored_packages": |
NewerOlder