Skip to content

Instantly share code, notes, and snippets.

View ccnokes's full-sized avatar
💭
hi

Cameron Nokes ccnokes

💭
hi
View GitHub Profile
//custom string manipulation class
class MyString {
constructor(str) {
this.str = str;
}
replaceVowels(replacement) {
this.str = this.str.replace(/a|e|i|o|u/gi, replacement);
}
//The valueOf() method returns the primitive value of the specified object.
valueOf() {
@ccnokes
ccnokes / whenready.js
Last active August 29, 2015 14:03
WhenReady object. Fires callback when all conditions are satisfied.
//executes a callback when all conditions are satisfied
function WhenReady(obj, cb) {
this.conditions = obj;
this.readyCallback = cb;
}
WhenReady.prototype = {
satisfyCondition: function(o) {
if(typeof o == 'object') {
@ccnokes
ccnokes / poller.js
Last active August 29, 2015 14:03
Poller object
function Poller(interval, cb, limit) {
var _this = this;
this.interval = interval || 250;
this.poll = null;
this.limit = limit;
var count = 0;
this.poll = setInterval(function() {
if(typeof cb == 'function') {
if(_this.limit) {