Skip to content

Instantly share code, notes, and snippets.

View mrailton's full-sized avatar

Mark Railton mrailton

View GitHub Profile
<?php
require_once("includes/init.php");
// instantiate blog class
$blog = new Blog($db);
$posts = $blog->get_posts();
$lastpostdate = $blog->last_post_date();
header("Content-Type: application/xml; charset=UTF-8");
echo '<?xml version="1.0" encoding="UTF-8" ?>' .
'<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">'.
'<channel>' .
<?php
/**
* Display the specified blog post.
*/
public function show($slug)
{
$post = Post::where('slug', $slug)->first();
return View::make('blog.post', compact('post'));
@mrailton
mrailton / gist:66a2e0d910d47afd6d16
Last active August 29, 2015 14:06
Blog post model in laravel
<?php
use Cviebrock\EloquentSluggable\SluggableInterface;
use Cviebrock\EloquentSluggable\SluggableTrait;
class Post extends Eloquent implements SluggableInterface {
protected $fillable = ['title', 'slug', 'user_id', 'content'];
use SluggableTrait;
<?php
use Cviebrock\EloquentSluggable\SluggableInterface;
use Cviebrock\EloquentSluggable\SluggableTrait;
class Post extends Eloquent implements SluggableInterface {
protected $fillable = ['title', 'slug', 'user_id', 'content'];
use SluggableTrait;
@mrailton
mrailton / sculpin_kernel.yml
Created December 27, 2014 17:33
sculpin_kernel file
sculpin_content_types:
posts:
permalink: blog/:filename/
sculpin_theme:
theme: sculpin/bootstrap-3-blog-theme
services:
twig.extension.text:
@mrailton
mrailton / publish.sh
Last active August 29, 2015 14:12
Sculpin publisher to github pages
#!/bin/bash
# Custom sculpin publishing file
# Mark Railton - marksrailton@gmail.com
if (( $# != 1 ))
then
echo "You must enter a commit message as an argument"
exit 1
fi
@mrailton
mrailton / sculpin_kernel.yml
Created February 17, 2015 14:25
Adding twig extension to sculpin - add to app/config/sculpin_kernel.yml
services:
twig.extension.text:
class: Twig_Extensions_Extension_Text
tags:
- { name: twig.extension }
@mrailton
mrailton / UserUpdateRequest.php
Last active September 22, 2015 09:01
Update user validation
<?php
namespace App\Http\Requests;
use Illuminate\Support\Facades\Hash;
class UserUpdateRequest extends Request
{
/**
* Determine if the user is authorized to make this request.

Keybase proof

I hereby claim:

  • I am railto on github.
  • I am railto (https://keybase.io/railto) on keybase.
  • I have a public key ASBuqYBAolnqsPlfJreo5_C1aGJMLFREkhFXE8hi-pUqmgo

To claim this, I am signing this object:

@mrailton
mrailton / playbook.yml
Created September 7, 2016 08:26 — forked from marklit/playbook.yml
Setup a load-balanced, two-node Django cluster
---
- name: SSH tightening
hosts: all
sudo: True
tasks:
- name: Disable root's ssh account
action: >
lineinfile
dest=/etc/ssh/sshd_config