Skip to content

Instantly share code, notes, and snippets.

View trevor-atlas's full-sized avatar
👾
Variety is the spice of life, or something

Trevor Atlas trevor-atlas

👾
Variety is the spice of life, or something
View GitHub Profile
@trevor-atlas
trevor-atlas / wp-config.php
Last active August 29, 2015 14:03
One file for local and dev wordpress (fixes urls to point locally instead of live)
/** MySQL settings - You can get this info from your web host */
$env = $_SERVER['HTTP_HOST'];
if ($env == 'dev.local' || $env == 'www.dev.local') {
/** The name of the database for WordPress */
define('DB_NAME', 'example');
/** MySQL database username */
define('DB_USER', 'example');
/** Dev Server Creds */
define('DB_PASSWORD', 'password');
@trevor-atlas
trevor-atlas / gist:830144ed2fc7b4251270
Last active August 29, 2015 14:06
base 64 1×1 GIF
transparent
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7">
black
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=">
source: http://css-tricks.com/snippets/html/base64-encode-of-1x1px-transparent-gif/
<!-- -->
switch (new Date().getDay()) {
case 0:
day = "Sunday";
break;
case 1:
day = "Monday";
break;
case 2:
day = "Tuesday";
break;
@trevor-atlas
trevor-atlas / zoomitbig
Created October 25, 2014 19:01
Cool wobbly animation seen in the footer of http://bjango.com/mac/istatmini/
@-webkit-keyframes zoomit {
15%,40%,75%,100% {
-webkit-transform-origin: center center;
}
15% {
-webkit-transform: scale(1.2, 1.1);
}
40% {
@trevor-atlas
trevor-atlas / remcalc.js
Last active August 29, 2015 14:08
convert between rem and px
var style = window.getComputedStyle(document.documentElement, null).getPropertyValue('font-size'),
fontSize = parseInt(style),
calcUnit = function(fn, unit) {
return fn(unit);
},
px = function(rem) {
return rem * fontSize;
// rem -> px
@trevor-atlas
trevor-atlas / pageCheck.js
Last active August 29, 2015 14:08
check the path name of the current URL, nice for conditional scripts.
var path = window.location.pathname.split('/')[1] || '/',
pageCheck = function(string) {
if (path === '/') {
path = 'home';
}
if (path !== string) {
return false;
}
return true;
@trevor-atlas
trevor-atlas / gist:c903b48c8ee8480c4a20
Created October 28, 2014 00:25
restore middle click functionality on e.preventDefault() links
// allow command-click and control-click to open new tab
if (event.metaKey || event.ctrlKey) {
return;
} else {
event.preventDefault();
}
gulp.task('jekyll', function(){
return require('child_process').spawn('jekyll', ['serve', '--watch'], { stdio: 'inherit' });
});
gulp.task('default', ['jekyll']);
@trevor-atlas
trevor-atlas / style testpage
Created November 12, 2014 02:11
simple html page with many common elements. Useful for testing styles and concistency. Ripped from github.com/google/web-starter-kit
<!doctype html>
<html lang="en" class="no-js no-touch" itemscope itemtype="http://schema.org/Article">
<head>
<meta charset="utf-8" >
<meta name="description" content="Visual style guide used by this site.">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta id="viewport" name="viewport" content="width=device-width, initial-scale=1">
<meta itemprop="name" content="Visual Style Guide — Web Starter Kit">
<meta itemprop="description" content="Visual style guide used by this site.">
@trevor-atlas
trevor-atlas / .htaccess
Created November 17, 2014 17:14
Force Https
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^domainname\.com*
RewriteRule ^(.*)$ https://www.domainname.com/$1 [L,R=301]