Skip to content

Instantly share code, notes, and snippets.

View Kindari's full-sized avatar

William Cahill-Manley Kindari

  • San Diego, California
View GitHub Profile
@Kindari
Kindari / keybase.md
Created March 16, 2017 22:39
keybase.md

Keybase proof

I hereby claim:

  • I am kindari on github.
  • I am kindari (https://keybase.io/kindari) on keybase.
  • I have a public key ASBIXXy13DuhdgA_tXzPS14Zd2c4QVkgbW64Z-ZsJ84lXwo

To claim this, I am signing this object:

@Kindari
Kindari / .bashrc
Last active October 24, 2016 15:13
Art (Laravel Artisan) command that can be used from almost any sub directory
art() {
# We cheat and assume that artisan is in the root of the repository. Thus the almost any sub directory. :)
if [[ $(git rev-parse --is-inside-work-tree 2>/dev/null) = "true" ]]; then
php `git rev-parse --show-toplevel`/artisan $@
else
echo "Can't find artisan, are you in a git repository?"
fi
}
@Kindari
Kindari / .bashrc
Created January 13, 2016 21:29
Forward Prompt to remote servers
SSH_FORWARD_PROMPT=true
export PS1="\n[\[\e[32m\]\t\[\e[m\] \[\e[31m\]\u\[\e[m\]@\[\e[36m\]\H\[\e[m\]][\[\e[32m\]\$?\[\e[m\]]\[\e[33m\]\`/usr/sbin/getenforce\`\[\e[m\]\n\w:\!> "
function ssh_forward_prompt()
{
env ssh -A "$@" -t "PS1='$PS1' bash -l"
}
if [ "$SSH_FORWARD_PROMPT" = true ] ; then
@Kindari
Kindari / Comment.php
Created March 23, 2014 22:27
Post with X comments per post
<?php
class Comment extends Eloquent
{
public function post()
{
return $this->belongsTo('Post');
}
public function scopePerPost($query, $limit) {
$ids = Cache::remember('paged_comment_ids', 10, function() use ($limit) {
$ids = array();
<?php namespace Acme\Database;
use Illuminate\Database\Schema\Blueprint as BaseBlueprint;
class Blueprint extends BaseBlueprint {}
<?php
class FormModel
{
public function validate()
{
...
<?php
use Illuminate\Pagination\BootstrapPresenter;
class PaginationPresenter extends BootstrapPresenter
{
public function getPageLinkWrapper($url, $page, $class='')
{
return '<li><a href="'.$url.'" class="' . $class . '">'.$page.'</a></li>';
<?php
return array(
'provider' => 'Geocoder\Provider\FreeGeoIpProvider',
'adapter' => 'Geocoder\HttpAdapter\CurlHttpAdapter'
);
@Kindari
Kindari / bar.php
Last active November 11, 2022 00:28
<?php
class Bar extends Eloquent {
public function foo() {
return $this->belongsTo('Foo');
}
}
@section('content')
Hello World!
@show