Skip to content

Instantly share code, notes, and snippets.

@Billy-
Billy- / gist:7e65c3b3e0027259ab63
Last active August 29, 2015 14:11
Mod_rewrite check
$a = ( in_array('mod_rewrite', apache_get_modules()) || strpos(shell_exec('/usr/local/apache/bin/apachectl -l'), 'mod_rewrite') !== false );
echo 'Mod rewrite is ' . ($a ? 'enabled' : 'disabled');
@Billy-
Billy- / handlebars.js
Last active August 29, 2015 14:27
Gulp task for compiling handlebars templates
var gulp = require('gulp');
gulp.task('handlebars', ['font:icon'], function () {
var config = require('../config');
var handlebars = require('gulp-compile-handlebars');
var bs = require('browser-sync').get('gulp');
var ext = require('gulp-ext');
var plumber = require('gulp-plumber');
var path = require('path');
var fs = require('fs');
@Billy-
Billy- / code_style_guidelines.md
Last active August 29, 2015 14:27
Here are the conventions that we should adhere to as a team in order to create consistency between our work. General guidelines below followed by more specific settings for editors that have been used by the team.

Code Style Guidelines

Here are the conventions that we should adhere to as a team in order to create consistency between our work. General guidelines below followed by more specific settings for editors that have been used by the team.

General guidelines

  • Don't save out files with trailing whitespace
  • Put a newline at the end of the file
  • Use Unix style (LF) line endings
FROM centos:7
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash \
&& source /root/.nvm/nvm.sh \
&& nvm install 5.0
@Billy-
Billy- / server.js
Last active October 23, 2016 17:50
Node static server handler
const http = require('http'),
staticServerHandler = require('./staticServerHandler'),
port = 8080
let server = http.createServer(staticServerHandler)
server.listen(port)
console.log('Static server listening on port ' + port)
@Billy-
Billy- / project-compose.sh
Created July 3, 2017 21:53
project-compose, to compose your docker-compose files across projects. I heard you liked composing files.
#!/bin/bash
dev=''
build=''
restart=''
help=''
getopt --test > /dev/null
if [[ $? -ne 4 ]]; then
echo "I’m sorry, `getopt --test` failed in this environment."
@Billy-
Billy- / tmux_build_from_source_CentOS.sh
Created January 20, 2018 21:47 — forked from P7h/tmux__CentOS__build_from_source.sh
tmux 2.0 and tmux 2.3 installation steps for Ubuntu. Or build from tmux source v2.5 for Ubuntu and CentOS.
# Steps to build and install tmux from source.
# Takes < 25 seconds on EC2 env [even on a low-end config instance].
VERSION=2.5
sudo yum -y remove tmux
sudo yum -y install wget tar libevent-devel ncurses-devel
wget https://github.com/tmux/tmux/releases/download/${VERSION}/tmux-${VERSION}.tar.gz
tar xzf tmux-${VERSION}.tar.gz
rm -f tmux-${VERSION}.tar.gz
cd tmux-${VERSION}
@Billy-
Billy- / rename-author.sh
Created October 10, 2018 19:35
Rewrite commit authors
# "borrowed" from https://stackoverflow.com/a/23564785/1879895
git filter-branch --commit-filter \
'if [ "$GIT_AUTHOR_NAME" = "OldAuthor Name" ]; then \
export GIT_AUTHOR_NAME="Author Name";\
export GIT_AUTHOR_EMAIL=authorEmail@example.com;\
export GIT_COMMITTER_NAME="Commmiter Name";\
export GIT_COMMITTER_EMAIL=commiterEmail@example.com;\
fi;\
git commit-tree "$@"'
@Billy-
Billy- / webpack-unused-files.sh
Created January 22, 2019 14:39 — forked from xjamundx/webpack-unused-files.sh
Quickly identify files unused by webpack
# ----------------------------------- #
webpack --display-modules | awk '{print $2}' | grep ^\.\/ > files-processed.txt;
cd src; # assumes all your files are here
find . -name *.js?(x) | grep -v eslint | grep -v __ > ../../files-all.txt; # excludes __tests__ and .eslintrc files
cd ..;
cat files-all.txt | xargs -I '{}' sh -c "grep -q '{}' files-processed.txt || echo '{}'";
rm files-processed.txt files-all.txt;
# ----------------------------------- #
@Billy-
Billy- / README.md
Last active April 15, 2019 16:48
deep version of lodash omit

Inspired by this issue on the lodash repo, asking for deep functionality for omit.

Note that there are plans to remove omit entirely in lodash v5... and props to this comment (and the one it quotes) in response to that 😆.