Skip to content

Instantly share code, notes, and snippets.

View mikedoubintchik's full-sized avatar

Mike Doubintchik mikedoubintchik

View GitHub Profile
// Check if fields are blank
$.fn.isFilled = function () {
var fields = $(this).serializeArray();
for (var i = 0; i < fields.length; i++) {
if (fields[i].value == '') {
return false;
}
}
return true;
@mikedoubintchik
mikedoubintchik / spoof-mac-address.sh
Created March 3, 2017 23:27
Here's a little bash script snippet for randomizing and spoofing your MAC address both on OS X and Linux
#!/usr/bin/env bash
echo "Are you on Mac? [y,n]"
read input
if [[ $input == "Y" || $input == "y" ]]; then
## Show active interfaces
ifconfig | pcregrep -M -o '^[^\t:]+:([^\n]|\n\t)*status: active'
## Ask which interface to spoof
echo "Which interface are you spoofing?"
read interface
/**
* Create popup function that takes url as input
* @param url
*/
function homescreenPopup(url) {
// Add popup container to top of body
$('body')
.prepend('<div class="homescreen-popup" style="background-image:url(' + url + ');"><div class="close-homescreen-popup">X</div></div>');
// Add click handler to remove popup
// This is the usual approach to creating functions in JS
var waitingList = [];
var buttons = document.querySelectorAll("button");
var input = document.querySelector("input");
var waitingListContainer = document.getElementById("waiting-list");
function addPeople(people) {
if (Array.isArray(people)) {
people.forEach(function(person, index) {
waitingList.push(person);
const ManageWaitingList = {
init() {
this.waitingList = [];
this.buttons = document.querySelectorAll("button");
this.input = document.querySelector("input");
this.waitingListContainer = document.getElementById("waiting-list");
this.bindEvents();
this.onLoad();
},
addPeople(people) {
// original array
var array = [[1,2,[3]],4];
/**
* Flatten function for arrays with unlimited depth
*/
const flatten = array => {
// if input is not array, throw error
if (!Array.isArray(array)) throw (new Error('This function can only be used on arrays'));
@mikedoubintchik
mikedoubintchik / walker.php
Created August 4, 2017 19:42
Navwalker class for Sage 9
<?php
namespace App;
/**
* Class NavWalker
*
* Bootstrap 4 walker with cleaner markup for wp_nav_menu()
* For use with Sage >= 8.5
*
@mikedoubintchik
mikedoubintchik / sublime-text-3-setup.md
Last active September 7, 2017 21:55 — forked from ijy/sublime-text-3-setup.md
My Sublime Text 3 setup.

Sublime Text 3 Setup

Install Package Control

Install Package Control for easy package management.

  1. Open the console with Ctrl+`
  2. Paste in the following:
<?php
/**
* Google Geocoding API
*
* Copyright (C) 2018 Allure Web Solutions <info@allurewebsolutions.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@mikedoubintchik
mikedoubintchik / Disable Android File Transfer From Launching Automatically
Created April 5, 2019 23:12
Disable Android File Transfer From Launching Automatically
PID=$(ps -fe | grep "[A]ndroid File Transfer Agent" | awk '{print $2}'); if [[ -n $PID ]]; then kill $PID; fi; mv "/Applications/Android File Transfer.app/Contents/Helpers/Android File Transfer Agent.app" "/Applications/Android File Transfer.app/Contents/Helpers/Android File Transfer Agent DISABLED.app"; mv "${HOME}/Library/Application Support/Google/Android File Transfer/Android File Transfer Agent.app" "${HOME}/Library/Application Support/Google/Android File Transfer/Android File Transfer Agent DISABLED.app"; osascript -e 'tell application "System Events" to delete every login item whose name is "Android File Transfer Agent"'