Skip to content

Instantly share code, notes, and snippets.

View elliotboney's full-sized avatar

Elliot Boney elliotboney

View GitHub Profile
@elliotboney
elliotboney / align.less
Created February 5, 2014 02:29
vertically align anything
@mixin vertical-align {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
.element p {
@include vertical-align;

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
#!/bin/sh
# tunnel.sh
# Configure
LOCAL_HOST=127.0.0.1;
USERNAME="your_username";
# set your remote address and SSH port.
TUNNEL_PORT="2022"
REMOTE_HOST="my.homedomainorip.com -p $TUNNEL_PORT";
@elliotboney
elliotboney / .tern-project
Created April 23, 2014 15:41
tern js .tern-project
{
"libs": [
"browser",
"jquery"
],
"plugins": {
"node": {},
"doc_comment": {}
}
}
@elliotboney
elliotboney / Lighten Darren.js
Created May 1, 2014 20:18
Lighten and Darken colors in js
function LightenDarkenColor(col, amt) {
var usePound = false;
if (col[0] == "#") {
col = col.slice(1);
usePound = true;
}
var num = parseInt(col,16);
(function (window, document) {
function onLoad(callback) {
if (document.readyState === "complete") {
setTimeout(callback, 1);
} else if (document.addEventListener) {
window.addEventListener("load", callback, false);
} else {
window.attachEvent("onload", callback);
}
@elliotboney
elliotboney / clearfix.css
Created May 31, 2014 14:59
Modern micro clearfix
/**
* For modern browsers
* 1. The space content is one way to avoid an Opera bug when the
* contenteditable attribute is included anywhere else in the document.
* Otherwise it causes space to appear at the top and bottom of elements
* that are clearfixed.
* 2. The use of `table` rather than `block` is only necessary if using
* `:before` to contain the top-margins of child elements.
*/
.cf:before,
@elliotboney
elliotboney / jquery.onAvailable.js
Last active August 29, 2015 14:02
Wait until ready w/javascript
$.fn.onAvailable = function(fn) {
var sel = this.selector;
var timer;
if (this.length > 0) {
fn.call(this);
} else {
timer = setInterval(function() {
if ($(sel).length > 0) {
fn.call($(sel));
clearInterval(timer);
@elliotboney
elliotboney / getparams.php
Last active August 29, 2015 14:03
Create matching variable names to $_GET parameters
<?php
$expected=array('module','act','gal_id','page_id','view','reply','post_id');
foreach($expected as $key){
if(!empty($_GET[$key])){
${key}=$_GET[$key];
} else{
${key}=NULL;
}
}
?>
@elliotboney
elliotboney / createcsv.php
Created July 3, 2014 02:03
Create csv file from php array
<?php
function generateCsv($data, $delimiter = ',', $enclosure = '"') {
$handle = fopen('php://temp', 'r+');
foreach ($data as $line) {
fputcsv($handle, $line, $delimiter, $enclosure);
}
rewind($handle);
while (!feof($handle)) {
$contents .= fread($handle, 8192);
}