Skip to content

Instantly share code, notes, and snippets.

Aaron Krauss alkrauss48

Block or report user

Report or block alkrauss48

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alkrauss48
alkrauss48 / index.html
Last active Jan 2, 2019
Audo-updating copyright footer using JS
View index.html
<p>
©
<script>document.write(new Date().getFullYear())</script>
<noscript>2019</noscript>
Your Silly Website. All Rights Reserved.
</p>
@alkrauss48
alkrauss48 / inactivity.js
Last active Oct 24, 2017
Pure JS way to handle mouse- and keyboard-inactivity from a user
View inactivity.js
var inactivityTime = function () {
var t;
window.onload = resetTimer;
// DOM Events
document.onmousemove = resetTimer;
document.onkeypress = resetTimer;
function inactivityLogout() {
// optional - turn off the event handlers
// useful for single page apps
View restart_nginx.sh
restart_nginx () {
# path to pgrep command
PGREP="/usr/bin/pgrep"
# Httpd daemon name,
HTTPD="nginx"
# find httpd pid
$PGREP ${HTTPD}
@alkrauss48
alkrauss48 / Dockerfile
Last active Nov 21, 2019
Running a docker container as a non-root user
View Dockerfile
# By default, Docker containers run as the root user. This is bad because:
# 1) You're more likely to modify up settings that you shouldn't be
# 2) If an attacker gets access to your container - well, that's bad if they're root.
# Here's how you can run change a Docker container to run as a non-root user
## CREATE APP USER ##
# Create the home directory for the new app user.
RUN mkdir -p /home/app
View base_table_styles.css
table {
min-width: 100%;
margin-bottom: 2em;
text-align: center;
}
tbody {
border: 2px solid #d1d1d1;
border-right: none;
}
View protoypal_javascript.js
var Person = {
name: '',
init: function(name){
this.name = name;
},
speak: function(){
console.log('My name is ' + this.name);
}
}
@alkrauss48
alkrauss48 / gulpfile.js
Last active Oct 16, 2019
Base gulpfile config for babel, browserify, and uglify - with sourcemaps and livereload
View gulpfile.js
var gulp = require('gulp');
var browserify = require('browserify');
var babelify = require('babelify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var livereload = require('gulp-livereload');
@alkrauss48
alkrauss48 / google_calendar_color_map.php
Last active Aug 29, 2015
Google Calendar Color Map
View google_calendar_color_map.php
<?php
// For some reason, when you embed a google calendar, the colors they
// display as background colors for the calendars don't fully match the colors
// that are in the embed code. This is a map from the hexadecimal color codes that
// are in the embed code to what they really render as in the embed
// This will help if you're building a custom legend, for example
$color_map = array(
@alkrauss48
alkrauss48 / change_multisite_url.sql
Last active Aug 29, 2015
SQL Script to handle changing the Wordpress MySQL DB when you need to change your Multisite primary domain
View change_multisite_url.sql
-- Run as:
-- mysql -uusername -p < change_multisite_url.sql
-- Set the db name, old site domain, and new site domain
use 'db_name';
SET @old_site = 'old_domain.com';
SET @site = 'new_domain.com';
@alkrauss48
alkrauss48 / Gruntfile.js
Created Mar 25, 2015
Base Browserify Configuration with Grunt Watching
View Gruntfile.js
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
browserify : {
app : {
files : {
'dist/app.js' : ['scripts/app.js']
}
You can’t perform that action at this time.