Skip to content

Instantly share code, notes, and snippets.

View jsjoeio's full-sized avatar

Joe Previte jsjoeio

View GitHub Profile
function bouncer(arr) {
// Don't show a false ID to this bouncer.
return arr.filter(Boolean);
}
bouncer([7, "ate", "", false, 9]);
function destroyer(arr) {
// Remove all the values
var args = Array.prototype.slice.call(arguments);
for(var i = 0; i < arr.length; i++){
for(var j = 0; j < args.length; j++){
if(arr[i] === args[j]){
delete arr[i];
}
}
}
function getIndexToIns(arr, num) {
var added = arr.push(num);
var sortArr = arr.sort(function(a, b) {
return a - b;
});
var index = sortArr.indexOf(num);
return index;
}
function rot13(str) { // LBH QVQ VG!
debugger;
var newArr = [];
for(var i = 0; i < str.length; i++){
var letter = str.charCodeAt(i);
if (64 < letter && letter < 78){
newArr.push(String.fromCharCode(letter+13));
}
else if(77 < letter && letter < 91){
@jsjoeio
jsjoeio / gist:5b1cf7b3e7aa935210f0a6a8c0cc8fef
Created May 27, 2017 16:28
YDKJS- book 4, chp 2- question 1
var a = [ ];
a["13"] = 42;
a.length; // 14
function spinalCase(str) {
//1. remove spaces, add -
//2. add - where capital letter
//3. remove underscore, add -
//4. remove spaces, add -
//5. remove
var newStr = str.replace(/ ([A-Z])/g, '-$1');
newStr = newStr.replace(/\s|_/g, '-');
function steamrollArray(arr) {
// I'm a steamroller, baby
var global_arr = [];
function extract(arr) {
for(var i=0; i < arr.length; i++) {
if(Array.isArray(arr[i])) {
extract(arr[i]);
} else {
global_arr.push(arr[i]);
}
<!-- This site is converting visitors into subscribers and customers with OptinMonster - https://optinmonster.com :: Campaign Title: amica medical supply --><div id="om-tnglw36uwq6xow74y69p-holder"></div><script>var tnglw36uwq6xow74y69p,tnglw36uwq6xow74y69p_poll=function(){var r=0;return function(n,l){clearInterval(r),r=setInterval(n,l)}}();!function(e,t,n){if(e.getElementById(n)){tnglw36uwq6xow74y69p_poll(function(){if(window['om_loaded']){if(!tnglw36uwq6xow74y69p){tnglw36uwq6xow74y69p=new OptinMonsterApp();return tnglw36uwq6xow74y69p.init({"u":"21286.708662","staging":0,"dev":0,"beta":0});}}},25);return;}var d=false,o=e.createElement(t);o.id=n,o.src="https://a.optnmstr.com/app/js/api.min.js",o.async=true,o.onload=o.onreadystatechange=function(){if(!d){if(!this.readyState||this.readyState==="loaded"||this.readyState==="complete"){try{d=om_loaded=true;tnglw36uwq6xow74y69p=new OptinMonsterApp();tnglw36uwq6xow74y69p.init({"u":"21286.708662","staging":0,"dev":0,"beta":0});o.onload=o.onreadystatechange=null;}catc
@jsjoeio
jsjoeio / gist:68c3cddd91d2e84778f98a4a03bd6425
Last active December 13, 2017 20:44
Twilio App - yarn install error log
Josephs-MacBook-Pro:call-forwarding-node-master josephprevite$ yarn install
yarn install v1.3.2
info No lockfile found.
[1/4] 🔍 Resolving packages...
warning sequelize-cli > gulp > vinyl-fs > graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
warning sequelize-cli > gulp > vinyl-fs > glob-stream > minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning sequelize-cli > gulp > vinyl-fs > glob-watcher > gaze > globule > minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning sequelize-cli > gulp > vinyl-fs > glob-watcher > gaze > globule > glob > graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
@jsjoeio
jsjoeio / gist:296e00a885e9665e4c53e9aad5e9fa6e
Created December 13, 2017 20:47
Twilio App - npm install --global yarn
Josephs-MacBook-Pro:~ josephprevite$ npm install --global yarn
npm WARN deprecated yarn@1.3.2: It is recommended to install Yarn using the native installation method for your environment. See https://yarnpkg.com/en/docs/install
/usr/local/bin/yarnpkg -> /usr/local/lib/node_modules/yarn/bin/yarn.js
/usr/local/bin/yarn -> /usr/local/lib/node_modules/yarn/bin/yarn.js
+ yarn@1.3.2
updated 1 package in 0.929s
Josephs-MacBook-Pro:~ josephprevite$ brew install yarn
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).