Skip to content

Instantly share code, notes, and snippets.

View mdixon47's full-sized avatar

Malik Dixon mdixon47

View GitHub Profile
@mdixon47
mdixon47 / README.md
Created November 5, 2018 23:47 — forked from letanure/README.md
VueJS Best Practices Guide

Deverus Vue.js Style Guide

Guide for developing Vue.js applications.

v. 0.0.1

Vue.js is an amazing framework, which can be as powerful as Angular or React, the two big heavy hitters in the world of front-end frameworks.

However, most of Vue's ease-of-use is due to the use of Observables - a pattern that triggers re-renders and other function calls with the reassignment of a variable.

@mdixon47
mdixon47 / gist:31483e67cbc3937332a4aafede383ecd
Created April 22, 2017 04:21 — forked from victormier/gist:9671147
Codewars: Largest Difference in Increasing Indexes
var largestDifference = function(data) {
var diff = data.length - 1,
i;
while(diff > 0) {
for(i = 0; i + diff < data.length; i++) {
if (data[i] <= data[i + diff]) {
return diff;
}
}
@mdixon47
mdixon47 / uniqueInOrder.js
Last active May 29, 2024 12:32
Implement the function unique_in_order which takes as argument a sequence and returns a list of items without any elements with the same value next to each other and preserving the original order of elements.
function uniqueInOrder(it) {
var result = []
var last
for (var i = 0; i < it.length; i++) {
if (it[i] !== last) {
result.push(last = it[i])
}
}
function pigLatin1(str){
var words = str.split(' ');
var result = [];
for(var i = 0; i < words.length; i++){
var word = words[i];
var firstLetter = word.slice(0, 1);
result.push(word.slice(1) + firstLetter + 'ay')
}
return result.join(' ');
}
@mdixon47
mdixon47 / diff.js
Created June 28, 2016 17:01
to inplement an difference function, which subtracts one from another.
function array_diff(a, b) {
var result = [];
a.forEach(function(element, index, list) {
if (element !== b[0]) {
result.push(element);
}
});
return result;
}
// The arrival date will be pre-populated with today’s date after to the page loads, and will be //highlighted when opening the datepicker widget. Dates later than today’s date will not be selectable.
$(function() {
$("#arrival").datepicker().datepicker("option",
"minDate", new Date())
.datepicker("option", "onSelect", function(dateText, instance) {
var arrivalDate = new Date(dateText);
arrivalDate.setDate(arrivalDate.getDate() + 1);
console.log(arrivalDate);
@mdixon47
mdixon47 / gist:a06af34b7ee4b4727774
Created January 1, 2016 04:28
Print the following two lines: Hello World. Welcome to 30 Days of Code.
function processData(input) {
console.log(input);
}
processData('Hello World. \n Welcome to 30 Days of Code.');
@mdixon47
mdixon47 / HackerRank arrays
Last active December 15, 2015 22:39
Simple Array Sum
var sum = 0;
function processData(input) {
var lines = input.split("\n");
var n = parseInt(lines[0]);
var arr = lines[1].split(" ");
for (var i = 0; i < n; i++) {
sum += parseInt(arr[i]);
}
console.log(sum);
}
@mdixon47
mdixon47 / private.js
Created October 9, 2015 00:57
Waypoint: Make Object Properties Private
var Car = function() {
this.gear = 1;
function addStyle(styleMe){
return 'The Current Gear Is: ' + styleMe;
}
this.getGear = function() {
return addStyle(this.gear);
};
};
var gulp = require('gulp'),
gutil = require('gulp-util'),
browserify = require('gulp-browserify'),
compass = require('gulp-compass'),
connect = require('gulp-connect'),
gulpif = require('gulp-if'),
uglify = require('gulp-uglify'),
minifyHTML = require('gulp-minify-html'),
concat = require('gulp-concat'),
jade = require('gulp-jade'),