Skip to content

Instantly share code, notes, and snippets.

View gavinengel's full-sized avatar

Gavin Engel gavinengel

View GitHub Profile
@gavinengel
gavinengel / dabblet.css
Created November 14, 2013 20:58 — forked from chriscoyier/dabblet.css
Checkbox Hack
/* Checkbox Hack */
input[type=checkbox] {
display: none;
}
label {
display: inline-block;
margin: 60px 0 10px 0;
cursor: pointer;
}
@gavinengel
gavinengel / openshift-daily-backup.php
Last active January 18, 2016 05:16
OpenShift/WordPress daily backup script
<?php
/**
* @author gavin@engel.com
* @version 2014-08-10-1254
* @homepage https://gist.github.com/gavinengel/2ca72704a3b30a07347a
*/
// Q: So, what is this php file?
// A: This helps you create both a files and a database dump backup every X days.
// (I don't trust WordPress backup plugins.)
// This is meant for OpenShift. Persistent folders in the "data" folder are backed up as well as repo "php/" files.
@gavinengel
gavinengel / brolog.js
Created February 26, 2016 21:27
(⌐■_■)
// party til you puke, dawg.
console.brolog = function(bromessage) {
awesomeizers = ['bro', 'dawg', 'my man'];
brogreeting = awesomeizers[ Math.floor(Math.random() * awesomeizers.length) ];
console.log(bromessage + ', ' + brogreeting + '.');
}
console.brolog('application complete');
@gavinengel
gavinengel / how-are-you.js
Last active March 8, 2016 21:17
Paste this into your Google Chrome Devtools console
var css = "text-shadow: -1px -1px hsl(0,100%,50%), 1px 1px hsl(5.4, 100%, 50%), 3px 2px hsl(10.8, 100%, 50%), 5px 3px hsl(16.2, 100%, 50%), 7px 4px hsl(21.6, 100%, 50%), 9px 5px hsl(27, 100%, 50%), 11px 6px hsl(32.4, 100%, 50%), 13px 7px hsl(37.8, 100%, 50%), 14px 8px hsl(43.2, 100%, 50%), 16px 9px hsl(48.6, 100%, 50%), 18px 10px hsl(54, 100%, 50%), 20px 11px hsl(59.4, 100%, 50%), 22px 12px hsl(64.8, 100%, 50%), 23px 13px hsl(70.2, 100%, 50%), 25px 14px hsl(75.6, 100%, 50%), 27px 15px hsl(81, 100%, 50%), 28px 16px hsl(86.4, 100%, 50%), 30px 17px hsl(91.8, 100%, 50%), 32px 18px hsl(97.2, 100%, 50%), 33px 19px hsl(102.6, 100%, 50%), 35px 20px hsl(108, 100%, 50%), 36px 21px hsl(113.4, 100%, 50%), 38px 22px hsl(118.8, 100%, 50%), 39px 23px hsl(124.2, 100%, 50%), 41px 24px hsl(129.6, 100%, 50%), 42px 25px hsl(135, 100%, 50%), 43px 26px hsl(140.4, 100%, 50%), 45px 27px hsl(145.8, 100%, 50%), 46px 28px hsl(151.2, 100%, 50%), 47px 29px hsl(156.6, 100%, 50%), 48px 30px hsl(162, 100%, 50%), 49px 31px hsl(167.4, 100%, 5
@gavinengel
gavinengel / sudoless-npm.sh
Last active April 30, 2016 22:36
sudoless-npm.sh
#!/bin/sh
# Place npm packages in your home folder without using sudo
# The lazy approach to installing cli npm programs requires sudo (root) access:
# $ sudo npm install -g somenpmpackage
# Of course, I do not recommend installing npm packages with sudo unless it's required.
# This is how I install CLI tools from npm without sudo:
# $ lib
# $ npm install --save somenpmpackage
@gavinengel
gavinengel / runner.sh
Last active June 28, 2016 16:15
Headless Selenium tests on your server
#!/bin/sh
# you want to be able to do browser testing, but in an automated way. here is how!
# Step 1: create your selenium script, using https://saucelabs.github.io/sb-sauce-plugin/, Firefox, and your text editor.
# Step 2: install some npm's:
# I was able to install selenium-standalone without sudo, using this method https://gist.github.com/gavinengel/1842179837823dc25730
lib;
npm install selenium-standalone;
@gavinengel
gavinengel / tsv2csv.py
Last active January 27, 2017 17:10 — forked from nsonnad/tsv2csv.py
#!/usr/bin/env python
import sys
import csv
tabin = csv.reader(sys.stdin, dialect=csv.excel_tab)
commaout = csv.writer(sys.stdout, dialect=csv.excel)
for row in tabin:
commaout.writerow(row)
@gavinengel
gavinengel / docker-notes.txt
Last active April 14, 2017 23:18
Docker notes
# productive Docker host?
1. https://coreos.com/os/docs/latest/booting-on-ec2.html and select HVM AMI
2. create single node (open TCP and UDP all)
3. ssh into node
4. install Rancher, see below
###
# I know it's an ugly, but it works for me. Complete installation process:
sudo apt-get update; sudo apt-get upgrade -y; sudo apt-get update;
sudo apt-get install -y python-software-properties python g++ make;
### 'add-apt-repository' not available on my Ubuntu 12.10 by default, so the next line adds it.
### more info found here: http://stackoverflow.com/questions/13018626/add-apt-repository-not-found
sudo apt-get install software-properties-common -y;
###
@gavinengel
gavinengel / intro.md
Created February 25, 2016 22:57 — forked from gschema/intro.md
Basic JavaScript MVC Implementation

Basic JavaScript MVC Implementation

Despite being derived from classical MVC pattern JavaScript and the environment it runs in makes Javascript MVC implementation have its own twists. Lets see how typical web MVC functions and then dive into simple, concrete JavaScript MVC implementation.

How Web MVC typically works

Typical server-side MVC implementation has one MVC stack layered behind the singe point of entry. This single point of entry means that all HTTP requests, e.g. http://www.example.com or http://www.example.com/whichever-page/ etc., are routed, by a server configuration, through one point or, to be bold, one file, e.g. index.php.

At that point, there would be an implementation of Front Controller pattern which analyzes HTTP request (URI at first place) and based on it decides which class (Controller) and its method (Action) are to be invoked as a response to the request (method is name for function and member is name for a variable when part of the class/object).