Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View iamkirkbater's full-sized avatar

Kirk Bater iamkirkbater

View GitHub Profile
@iamkirkbater
iamkirkbater / colors.sh
Last active January 2, 2016 17:08
Shell Script to add Vhost.Run as root, takes one param: Directory to add, and extra optional param as subdirectory written as /subdirectory where / is folder root.ex: sudo bash newSite.sh [-h | -c | -m ] <nameOfNewsite> [subDirectory DocumentRoot] To run as commands, place files in your /usr/local folder without the .sh extensions, and then just…
#!/bin/sh
# Define colors
red="\033[33;31m"
green="\033[33;32m"
yellow="\033[33;33m"
blue="\033[33;34m"
magenta="\033[33;35m"
gray="\033[33;30m"
cyan="\033[33;36m"
A list:
[Title] [Git URL] [Bower URL]
----
Backwards Compatibility:
Respond.js https://github.com/scottjehl/Respond scottjehl/Respond
Placeholder.js https://github.com/jamesallardice/Placeholders.js jamesallardice/placeholders
@iamkirkbater
iamkirkbater / buildOptions.php
Last active August 29, 2015 13:58
This function takes an array of strings and then uses those strings to populate both the value and display fields of an <option> tag. Two optional parameters are included: $first and $selected. $first is used to customize what the first option tag will consist of. For example, if you are using this to sort a list of countries, you would change i…
<?php
/**
* Sanitizes a variable
*
* Sanitizes by reference for use with Array_Walk_Recursive. Remove the ampersand if you aren't using that function.
*
* @param $var - String to sanitize.
* @return string - Sanitized String
*/
@iamkirkbater
iamkirkbater / after.js
Created April 30, 2014 14:30
People Sorting "plugin", before and After
var toSlug = function(Text) {
return Text
.replace(/ /g,'-')
.replace(/\&/g,'+');
},
unSlug = function(Slug) {
return Slug
.replace(/\-/g,' ')
.replace(/\+/g,'&');
};
@iamkirkbater
iamkirkbater / autoSizr.js
Created August 6, 2014 13:45
Simple jQuery Plugin that auto resizes text to fill a specific sized div (great for responsive slideshows that utilize large banner text with variable lengths), derived from https://gist.github.com/iam4x/5015270
$.fn.autoSizr = function () {
var el, elements, _i, _len, _results;
elements = $(this);
if (elements.length < 0) {
return;
}
_results = [];
for (_i = 0, _len = elements.length; _i < _len; _i++) {
el = elements[_i];
_results.push((function(el) {
@iamkirkbater
iamkirkbater / title-sort.php
Created February 11, 2015 03:06
Sort by title algorithms
/**
* @param $a
* @param $b
* @return int
*
* Assumes that the list is already sorted alphabetically, this function will sort Directors, Associate Directors, and
* Assistant directors to the front of the list, respectively.
*/
function sortByTitle ($a, $b)
{
<?php
if ( !class_exists( 'DB' ) ) {
class DB {
public function __construct($user, $password, $database, $host = 'localhost') {
$this->user = $user;
$this->password = $password;
$this->database = $database;
$this->host = $host;
}
protected function connect() {
@iamkirkbater
iamkirkbater / htla.js
Created April 7, 2015 17:35
Hamburger to Left Arrow Animation
(function() {
"use strict";
var toggles = document.querySelectorAll(".cmn-toggle-switch");
for (var i = toggles.length - 1; i >= 0; i--) {
var toggle = toggles[i];
toggleHandler(toggle);
};
@iamkirkbater
iamkirkbater / _mixins.scss
Last active December 29, 2015 01:56
Mixins I commonly use.
@mixin font-smoothing($value: on) {
@if $value == on {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@else {
-webkit-font-smoothing: subpixel-antialiased;
-moz-osx-font-smoothing: auto;
}
}
@iamkirkbater
iamkirkbater / _drupalisms.scss
Created August 18, 2015 15:24
Overrides for default drupal styles.
// Drupal Overrides
ul.tabs.primary {
border-bottom: 0;
border-top: 1px solid #bbb;
text-align:right;
margin: 0;
li.active a {
border-bottom: 1px solid #bbb;
border-top: 1px solid #fff;
}