Skip to content

Instantly share code, notes, and snippets.

View sixlive's full-sized avatar

TJ Miller sixlive

View GitHub Profile
@sixlive
sixlive / jquery.printDiv.js
Last active August 29, 2015 14:07
JS: Print Specific Content
( function($) {
/**
* Prints single div content. Adds a class to the body of 'js-print' for
* targeting specific styles.
*
* @return void
*/
$.fn.printDiv = function() {
var printContents = $(this).html();
@sixlive
sixlive / wp-get-post-awesome-pagination.php
Last active August 29, 2015 14:07
WordPress: Pagination With Get Post Awesome Loop
<?php
// Setup vars for pagination.
$per_page = 10;
$current_page = ( intval( get_query_var('paged') ) ) ? intval( get_query_var( 'paged' ) ) : 1;
$offset = $per_page * ($current_page - 1);
// Config, subsitute / add whatever you need. Leave per_page and offset as the vars.
$sweet_args = [
'numberposts' => $per_page,
'post_type' => 'post',
@sixlive
sixlive / content-list.md
Last active August 29, 2015 14:09
Test Post Content for WordPess Theming
  • Links (internal, external)
  • Heading (h1-h6)
  • Ordered Lists (ol)
  • Unordered Lists (ul)
  • Aligned Images (left, right, center)
  • Bold (strong)
  • Italic (em)
  • Underline (underline)
  • Address (address)
  • Blockquote (blockquote)

Keybase proof

I hereby claim:

  • I am sixlive on github.
  • I am sixlive (https://keybase.io/sixlive) on keybase.
  • I have a public key whose fingerprint is 584F E70F 15E5 4E38 28DD FC52 7371 D9F8 90BE 6170

To claim this, I am signing this object:

@sixlive
sixlive / get-youtube-code.php
Last active March 7, 2016 16:10
PHP: Gets the video code from a YouTube video URL.
<?php
/**
* Returns the ID of a YouTube Video URL
*
* This works with both the short and full URL.
*
* @param string $url The video URL
* @return string The video ID
* @author TJ Miller http://tjay.co
@sixlive
sixlive / belongs-to-many.sublime-snippet
Created May 15, 2016 16:03 — forked from adamwathan/belongs-to-many.sublime-snippet
Eloquent Relationship snippets for Sublime Text
<snippet>
<content><![CDATA[
public function ${1:relationship}()
{
return \$this->belongsToMany(${1/^(.+)$/(?1\u$1:)/g}::class, {$2:table});
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>belt</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
@sixlive
sixlive / Caddyfile
Created April 7, 2017 19:51 — forked from alexbilbie/Caddyfile
PHP-FPM Caddyfile example
root /app/public
tls /app/_docker/caddy/server.crt /app/_docker/caddy/server.key
fastcgi / php:9000 php
errors visible
rewrite {
regexp .*
ext /
to /index.php?{query}
}
@sixlive
sixlive / gistlog.yml
Last active August 24, 2017 14:12
Handy Shell Aliases and Functions
published: true
@sixlive
sixlive / 0.POST.md
Last active August 29, 2017 12:49
Basic Resource Response Example

Here is a brief example/preview of the new Laravel 5.5 resource responses. Taylor will be going into much greater detail about this at the Laracon EU conference (2017).

Resource Response

{
  "data": {
    "id": "0b1a798c-7e7e-46d1-8c4c-0c786730d36f",
    "name": null,
    "status": "Ready"
@sixlive
sixlive / 0.POST.md
Last active August 31, 2017 19:40
Stackable Command Output

This is a little trait I use to stack output over the course of a command and display all the output at the end.

trait StackableOutput
{
    protected $stackedOutput = [];

    private function stackOutput($content, $type = 'line')
    {
 array_push($this-&gt;stackedOutput, [