Skip to content

Instantly share code, notes, and snippets.

function CheckStrMutation(str1,str2) {
var arr = [str1,str2];
var mutationBool = true;
for(var i = 0; i < arr[1].length; i++)
{
if(arr[0].toLowerCase().indexOf(arr[1].slice(i,i+1).toLowerCase()) === -1)
{
mutationBool = false;
function excludeNullsFromArray(arr) {
function isTruthy(arg){
//typecast elements to bool. array.filter iterates, so 'true' elements will
// be included in final return.
return Boolean(arg);
}
return(arr.filter(isTruthy));
}
function removeElementsFromArray(arr) {
//removeElementsFromArray(array,a,b,c,..)
var args = Array.prototype.slice.call(arguments);
args.splice(0, 1);
return arr.filter(function(element) {
return args.indexOf(element) === -1;
});
}
removeElementsFromArray([1, 2, 3, 1, 2, 3], 2, 3);
@dmidlo
dmidlo / indexOfElement.js
Last active March 25, 2017 06:47
indexOfElement.js
function indexOfElement(arr, num) {
arr.push(num);
arr.sort(function(a,b){return a-b;});
return(arr.indexOf(num));
}
indexOfElement([5, 3, 20, 3], 5);
sudo port install iTerm2 zsh
(MacPorts Zsh Post Installation Notes)
zsh has the following notes:
To set MacPorts' zsh as default login shell, run:
sudo chpass -s '/opt/local/bin/zsh' $USER
To be able to switch default shells to or from zsh without superuser privileges, add it to
/etc/shells:
sudo sh -c 'echo /opt/local/bin/zsh >>/etc/shells'
$ which zsh
/bin/zsh
$ zsh --version
zsh 5.2 (x86_64-apple-darwin16.0)
$ port contents zsh | grep bin
/opt/local/bin/zsh
/opt/local/bin/zsh-5.3.1
/opt/local/share/zsh/5.3.1/functions/_bind_addresses
/opt/local/share/zsh/5.3.1/functions/_bindkey
/opt/local/share/zsh/5.3.1/functions/_combination
/opt/local/share/zsh/5.3.1/help/bindkey
$ /opt/local/bin/zsh --version
zsh 5.3.1 (x86_64-apple-darwin16.4.0)
/opt/local/bin/zsh
$ cat /etc/shells
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.
/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh