Skip to content

Instantly share code, notes, and snippets.

View johnfoderaro's full-sized avatar

John Foderaro johnfoderaro

View GitHub Profile
@johnfoderaro
johnfoderaro / .json
Last active August 15, 2020 19:55
tcf2-english
{
"en-us": {
"default": {
"heading": "Data and Cookie Consent",
"details1": {
"text1": "We and ",
"link1": "our partners",
"purpose1": "Store and/or access information on a device"
},
"details2": {
@johnfoderaro
johnfoderaro / stack.js
Created December 6, 2017 22:05
ES6+ Stack Class Implementation
class Stack {
constructor() {
this.items = [];
}
push(element) {
this.items.push(element);
}
pop() {
return this.items.pop();
}
@johnfoderaro
johnfoderaro / Vagrantfile
Last active December 6, 2017 17:31
Current Vagrant file that I use for 16.04 VMs on Virtual Box
VM_BOX = 'ubuntu/xenial64'
Vagrant.configure(2) do |config|
config.vm.box = VM_BOX
config.vm.network "private_network", type: "dhcp"
config.vm.provider "virtualbox" do |vb|
vb.memory = 1024
end
config.vm.provision 'shell', inline: <<-SHELL
echo 'ubuntu:ubuntu' | sudo chpasswd
SHELL
@johnfoderaro
johnfoderaro / array-shuffle.js
Created July 19, 2017 15:56
Shuffle an array's contents
function shuffle(array) {
const shuffledArray = [];
for (let i = 0; shuffledArray.length !== array.length; i++) {
const randomIndex = Math.floor(Math.random() * array.length);
if (!shuffledArray.includes(array[randomIndex])) {
shuffledArray.push(array[randomIndex]);
}
}
return shuffledArray;
}
@johnfoderaro
johnfoderaro / socket.js
Last active May 3, 2017 01:42
857-bytes
'use strict';
const activeBuilds = [];
function socketEmitter(res, type, data) {
// emit the event
res.app.get('io').sockets.emit(type, data);
// store the last event per project for future connections
@johnfoderaro
johnfoderaro / gulpfile.js
Created February 26, 2017 01:49
Express app Gulpfile for asset build/management with Browersify, Node Sass, Imagemin, and Browser Sync
'use strict';
const browserify = require('browserify');
const bs = require('browser-sync').create();
const buffer = require('vinyl-buffer');
const del = require('del');
const gif = require('imagemin-gifsicle');
const gulp = require('gulp');
const gutil = require('gulp-util');
const imagemin = require('gulp-imagemin');
@johnfoderaro
johnfoderaro / httpd.conf
Created December 24, 2016 15:09
Default httpd.conf file - macOS Sierra 10.12.2 - /etc/apache2/httpd.conf
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
@johnfoderaro
johnfoderaro / decimal-to-binary.js
Last active October 14, 2022 09:02
A simple function to convert a variable value to binary.
function binaryConvert() {
var num = x;
if (num != Math.floor(num)) {
console.log("Please enter a number");
} else if (num < 0) {
console.log("Please enter a positive number");
} else {