Skip to content

Instantly share code, notes, and snippets.

@bjorntheart
Last active August 29, 2015 14:16
Show Gist options
  • Save bjorntheart/ccb312675f5bca958b49 to your computer and use it in GitHub Desktop.
Save bjorntheart/ccb312675f5bca958b49 to your computer and use it in GitHub Desktop.

So, you might be asking yourself, what is Gistlog?

Gistlog is a blogging "platform" for people who want to quickly write and publish content, in Markdown, and don't want to bother with yet another platform and yet another login and yet another group hoarding their content. With Gistlog, you use your pre-existing Github login, you store the data in your own Github account, and you can publish with a single click.

Using Gistlog

  1. Create a public gist with a single file using Markdown. Set the gist description to be the title of your blog post
  2. Copy the gist URL, and paste it into the text box on the Gistlog home page
  3. Copy your resulting URL and share it as your blog post--note that it will be in the form of http://gistlog.co/your-github-username/gist-id
<?php
namespace Pagekit\Hello\Controller;

use Pagekit\Framework\Controller\Controller;

/**
 * @Route("/api/v1/")
 */
 
 // This will mount the OrdersController to http://yourapp.com/api/v1
 
class OrdersController extends Controller
{

  /**
  * @var Repository
  */
  protected $orders;

  /**
   * @Route("/orders")
   * @Request({"limit":"int", "page":"int"})
   * @Response("json")
   */
    public function indexAction($limit = 10, $page = 0)
    {
        // do some stuff here
        $this->orders = $this['db.em']->getRepository('Pagekit\Blog\Entity\Order');
        $query = $this->orders->query();

        $count = $query->count();
        $total = ceil($count / $limit);
        $page = max(0, min($total - 1, $page));
        $orders = $query->offset($page * $limit)->limit($limit)->orderBy('date', 'DESC')->get();

        return [
          'success' => true, 
          'message' => "{$total} Orders returned",
          'orders'  => $this->orders,
          'pagination' => [
            'count' => $count,
            'total' => $total
            'next'  => ($page + 1)
          ]
        ];
    }

?>

What's coming next?

In addition to adding some sugar to the presentation layer, and hooking into Github comments without having to visit the Gist page, we're also hoping to transform Gistlog to become the sole place you need to go to create a Gist-backed, Markdown-formatted, blog.

Everything's out in the open, so check out the Github Repo if you want.

Enjoy!

-Matt Stauffer & Adam Wathan of Tighten Co.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment