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
const traceFn = (fn, context) => function () {
console.trace(`${fn.name} called with arguments: `, arguments);
return fn.apply(context || this, arguments);
}
console.log = traceFn(console.log);
console.log('foo');
//>> log called with arguments: ["foo"]
//>> (anonymous) @ VM98:2
//>> (anonymous) @ VM138:2
{
"Badge Text" : "🌮",
"Working Directory" : "\/Users\/trevorallen",
"Prompt Before Closing 2" : false,
"Selected Text Color" : {
"Red Component" : 0.1178457885980606,
"Color Space" : "Calibrated",
"Blue Component" : 0.1535659581422806,
"Alpha Component" : 1,
"Green Component" : 0.1286772042512894

Keybase proof

I hereby claim:

  • I am trevor-atlas on github.
  • I am tatlas (https://keybase.io/tatlas) on keybase.
  • I have a public key ASAqR4yrUTlbnxRnDCNXTXEOtjmn-bpBTDNSizlO4-8tbAo

To claim this, I am signing this object:

@trevor-atlas
trevor-atlas / checkMediaQuery.ts
Last active October 10, 2017 15:19
get current media query size from HTML::before
/**
* check the html::before element for a string indicating the currect css media query.
* @return boolean if the passed string matches the current media query contained in the ::before's content attribute.
* In your css just add a content value to the html::before element that you can check for a size.
* E.G: if (MQ('large')) { ...do stuff }
*/
const MQ = (MQName: string): boolean => {
return MQName === window
.getComputedStyle(document.documentElement, '::before')
.getPropertyValue('content')
<?php namespace PageInfo;
add_action( 'admin_menu', function() {
add_menu_page('All of the pageinfo', 'Pageinfo', 'edit_pages', 'pageinfo', __NAMESPACE__.'\\createAdminPage', 'dashicons-clipboard', 6);
});
function createAdminPage() {
?>
<div class="wrap">
<?php
// This queries wordpress for every page and outputs the url and ID for each one.
@trevor-atlas
trevor-atlas / .bashrc
Last active August 26, 2016 21:38 — forked from vsouza/.bashrc
Golang 1.5 setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@trevor-atlas
trevor-atlas / countries.php
Created June 3, 2016 22:06 — forked from JeffreyWay/countries.php
Country Names + Codes
[
"United States" => "us",
"Afghanistan" => "af",
"Albania" => "al",
"Algeria" => "dz",
"American Samoa" => "as",
"Andorra" => "ad",
"Angola" => "ad",
"Anguilla" => "ai",
"Antarctica" => "aq",
#!/bin/sh
# bandwith.sh - print a bandwidth report
# run from cron at 11:59 PM
# with sorting the traffic and other domains
DIR=/var/cpanel/bandwidth
DIRTMP=/tmp
tmpdomains=tmpdomains
outfile=outfile
outfile2=outfile2
.semantic-container {
display: table;
width: 100%;
}
.semantic-wrapper {
display: table-cell;
text-align: center;
vertical-align: middle;
}
window.myApp = {};
/*! loadJS: load a JS file asynchronously. [c]2014 @scottjehl, Filament Group, Inc. (Based on http://goo.gl/REQGQ by Paul Irish). Licensed MIT */
function loadJS( src, cb ){
"use strict";
var ref = window.document.getElementsByTagName( "script" )[ 0 ];
var script = window.document.createElement( "script" );
script.src = src;
script.async = true;
ref.parentNode.insertBefore( script, ref );
if (cb && typeof(cb) === "function") {