Skip to content

Instantly share code, notes, and snippets.

View kaimallea's full-sized avatar
:octocat:

Kai Mallea kaimallea

:octocat:
View GitHub Profile
@kaimallea
kaimallea / gist:6257988
Last active December 21, 2015 05:38
Trim
if (typeof String.prototype.trim !== 'function') {
String.prototype.trim = function() {
return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");
};
}
function encode(str) {
if (!str) { return; }
if (/[^a-z]/i.test(str)) { throw Error('Letters only'); }
var len = str.length,
i = 1,
output = '',
counter = 1;
for (; i <= len; i++) {
@kaimallea
kaimallea / .gitconfig
Last active November 13, 2018 00:19
Git config
[user]
name = Kai Mallea
email = [email protected]
[color]
ui = true
[alias]
st = status
co = checkout
br = branch
lg = log --name-only --graph
[2013-05-10 14:10:15] ERROR 2: include_once(/var/www/phabricator/phabricator/src/storage/exception/AphrontQuerySchemaException.php): failed to open stream: No such file or directory at [/var/www/phabricator/libphutil/src/__phutil_library_init__.php:294]
#0 PhutilBootloader::executeInclude called at [/var/www/phabricator/libphutil/src/__phutil_library_init__.php:294]
#1 PhutilBootloader::executeInclude(/var/www/phabricator/phabricator/src/storage/exception/AphrontQuerySchemaException.php) called at [/var/www/phabricator/libphutil/src/__phutil_library_init__.php:270]
#2 PhutilBootloader::loadLibrarySource(phabricator, storage/exception/AphrontQuerySchemaException.php) called at [/var/www/phabricator/libphutil/src/symbols/PhutilSymbolLoader.php:385]
#3 PhutilSymbolLoader::loadSymbol(Array of size 5 starting with: { type => class }) called at [/var/www/phabricator/libphutil/src/symbols/PhutilSymbolLoader.php:291]
#4 PhutilSymbolLoader::selectAndLoadSymbols() called at [/var/www/phabricator/libphutil/src/__phutil_
@kaimallea
kaimallea / gist:5495629
Last active December 16, 2015 20:49
RequireJS, Conditional baseUrl
require.config({
baseUrl: (function determineBaseUrl() {
var environments = {
'default': '/ui/scripts/js/',
'dev.trutv.com': '//z.devcdn.turner.com/trutv/trutv.com/ui/scripts/js/',
'www.trutv.com': '//z.cdn.turner.com/trutv/trutv.com/ui/scripts/js/'
};
return ( environments[window.location.hostname] || environments.default );
})()
// Media Queries in Sass 3.2
//
// These mixins make media queries a breeze with Sass.
// The media queries from mobile up until desktop all
// trigger at different points along the way
//
// And important point to remember is that and width
// over the portrait width is considered to be part of the
// landscape width. This allows us to capture widths of devices
// that might not fit the dimensions exactly. This means the break
<?php
// Use in the "Post-Receive URLs" section of your GitHub repo.
if ( $_POST['payload'] ) {
shell_exec( '/home/ubuntu/updatesite' );
}
@kaimallea
kaimallea / .vimrc
Created June 18, 2012 22:16
Vim Terminal Config
set nocompatible
filetype on
filetype plugin on
filetype indent on
syntax on
set ruler
set tabstop=4
@kaimallea
kaimallea / gist:2570214
Created May 1, 2012 18:17
Clearfix -- when used on the parent, the children will be self-cleared
.group:before,
.group:after {
content: "";
display: table;
}
.group:after {
clear: both;
}
.group {
zoom: 1; /* IE6&7 */
@kaimallea
kaimallea / hack.sh
Created March 31, 2012 20:30 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#