Skip to content

Instantly share code, notes, and snippets.

View devNoiseConsulting's full-sized avatar

Michael Flynn devNoiseConsulting

View GitHub Profile
@devNoiseConsulting
devNoiseConsulting / gist:870309dc150ce3df29138a342dccaf40
Created February 21, 2017 17:08
Apache config for Magento 2.
<Directory "/home/magento_user/www/html">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
# New directive needed in Apache 2.4.3:
Require all granted
</Directory>
@devNoiseConsulting
devNoiseConsulting / mkMagneto.sh
Created February 24, 2017 01:44
Commands to get Magento running on Ubuntu
#!/bin/bash -x
# This scripts assumes that you already have all the correct packages
# installed and configured the virtual host for Apache 2.x. Also
# assuming that you've added the magento cli to your $PATH.
cd ~/www/html/
# "Nuke It From Orbit" - I've screwed up my Magento install and couldn't
# seem to back out the change. So I gave up and started over.
@devNoiseConsulting
devNoiseConsulting / dp20170227.js
Last active March 16, 2017 16:21
Merge the following two sorted arrays into one sorted array - PhillyDev Slack #daily_programmer - 20170227
/*
Good morning! Today's daily programmer is about Array's and sorting. The
gist of this question came from a friends recent interview. It may be a
relatively familiar task. Feel free to write the solution in two
different ways to challenge yourself, or use a different language.
Please DM me with idea's for future daily problems. When you have
completed it post a link to your solution. *If you have a question about
someones solution please use a thread under their posted link.* Happy
Monday!
*/
@devNoiseConsulting
devNoiseConsulting / dp20170228.js
Last active March 16, 2017 16:20
Ordinal Numbers - PhillyDev Slack #daily_programmer - 20170228
/*
Today's daily programmer challenge is to print a marathon finishers
place in English. Your program should take an non decimal input
`getFinishPosition(11)` and return `11th place`, `getFinishPosition(21)`
and return `21st place`, `getFinishPosition(4)` and return `4th place`,
and `getFinishPosition(33)` and return `33rd place`.
Please DM me with ideas for future problems. When you have completed it
post a link to your solution. No need to go over 99 finishers, unless
you want to.
@devNoiseConsulting
devNoiseConsulting / dp20170301.js
Last active March 16, 2017 16:20
Magic Square Check - PhillyDev Slack #daily_programmer - 20170301
function magicSquareCheck(square) {
checkIndices = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
[0, 3, 6],
[1, 4, 7],
[2, 5, 8],
[0, 4, 8],
[2, 4, 6]
@devNoiseConsulting
devNoiseConsulting / dp20170302.js
Last active March 16, 2017 16:19
Alphabetical Word Check - PhillyDev Slack #daily_programmer - 20170302
let words = [
'abort', 'times', 'alloy', 'taught', 'arrow', 'know', 'below', 'onscreen',
'berry', 'idea', 'cello', 'spoonfeed', 'asked', 'deist', 'worlds', 'feint',
'best', 'floss', 'suggest', 'hilly', 'hippy'
];
function alphabeticalWord(word) {
let letters = word.split('').sort().join('');
// return (word == letters) ? true : false;
// Simplifing the return statement after feedback from Brian McElaney
@devNoiseConsulting
devNoiseConsulting / dp20170303.js
Last active March 16, 2017 16:19
Best price per square foot - PhillyDev Slack #daily_programmer - 201703
/*
Download the data file from:
https://github.com/aisflat439/dailyProgrammer/blob/master/data/realEstate.csv
0 street
1 city
2 zip
3 state
4 beds
5 baths
@devNoiseConsulting
devNoiseConsulting / dp20170306.js
Last active March 16, 2017 16:19
Parking at Hanoi - PhillyDev Slack #daily_programmer - 20170306
/*
There are N+1 parking spots, numbered from 0 to N. There are N cars numbered
from 1 to N parked in various parking spots with one left empty. Reorder the
cars so that car #1 is in spot #1, car #2 is in spot #2 and so on. Spot #0 will
remain empty. The only allowed operation is to take a car and move it to the
free spot.
*/
function initParking(size) {
let parking = (new Array(size)).fill(null);
@devNoiseConsulting
devNoiseConsulting / dp20170307.js
Last active March 16, 2017 16:19
Hamming Distance - PhillyDev Slack #daily_programmer - 20170307
/*
Calculate the Hamming Distance between 2 DNA strands.
*/
const dna1 = "GAGCCTACTAACGGGAT";
const dna2 = "CATCGTAATGACGGCCT";
function hammingDistance1(strand1, strand2) {
let count = 0;
if (strand1 && strand2) {
if (strand1.length == strand2.length) {
@devNoiseConsulting
devNoiseConsulting / dp20170308.js
Last active March 16, 2017 16:18
Kaprekar's Routine - PhillyDev Slack #daily_programmer - 20170308
/*
Write a function that counts the number of iterations in Kaprekar's Routine,
which is as follows.
Given a 4-digit number that has at least two different digits, take that
number's descending digits, and subtract that number's ascending digits. For
example, given 6589, you should take 9865 - 5689, which is 4176. Repeat this
process with 4176 and you'll get 7641 - 1467, which is 6174.
Once you get to 6174 you'll stay there if you repeat the process. In this case
we applied the process 2 times before reaching 6174, so our output for 6589 is
2.