Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am clarkf on github.
  • I am clarkf (https://keybase.io/clarkf) on keybase.
  • I have a public key ASAKnLMZYzXpcpxp68yOJZ-cYL2t8YYFCkS-eVFwegex1Qo

To claim this, I am signing this object:

@clarkf
clarkf / frp.elm
Created March 5, 2016 06:44
Functional. Reactive. Beautiful. Try pasting this at http://elm-lang.org/try
import Html exposing (iframe, Html)
import Html.Attributes exposing (seamless, attribute, height)
import String exposing (concat, join)
-- FIXME
secure_required : Bool
secure_required = True
protocol : String
protocol =
@clarkf
clarkf / php
Created December 12, 2014 19:29
Pin Apache/PHP to Precise (PHP 5.3) in Trusty
# /etc/apt/preferences.d/php
Package: php
Pin: release n=precise
Pin-Priority: 991
Package: php*
Pin: release n=precise
Pin-Priority: 991
Package: apache*
{
"handlers": {
"flapjack": {
"type": "pipe",
"command": "/etc/sensu/handlers/flapjack.rb"
}
},
"flapjack": {
"host": "localhost",
"port": 6379,
@clarkf
clarkf / EggProcurementController.php
Created March 21, 2014 02:41
A really bad Dependency Injection example
<?php
namespace Acme\CookieRobot\Controllers;
use Acme\FoodInventory;
class EggProcurementController extends BaseController
{
/**
* @type Acme\FoodInventory
*/
<?php
Route::get('testquery', function ()
{
$data->ranks = PictureRank::with('lists') //, 'lists.authorable', 'lists.likes'
->where('added_on', '<', 15000000)
->orderBy('added_on', 'desc')
->take(15)
->get();
@clarkf
clarkf / laravel-rest.js
Created January 31, 2014 23:21
Laravel 4 REST Helper without jQuery
(function (document) {
document.addEventListener('DOMContentLoaded', function(){
// Document loaded
/**
* Listen for click events on elements that have a data-method
* attribute.
*
* This should work on all modern browsers (IE 9+)
*
<?php
require_once __DIR__ . "/vendor/autoload.php";
use Cocur\Slugify\Slugify;
$x = new Slugify;
var_dump($x);
@clarkf
clarkf / jquery-laravel.js
Created January 24, 2014 20:42
jQuery Helper for data-method functionality
jQuery(function ($) {
/**
* Handle clicks on links with the "data-method" attribute, such as
*
* <a href="/resources/1" data-method="delete">Delete Resource</a>
*/
$(document).on('click', '[data-method]', function () {
var $this = $(this),
method = $this.data('method'),
action = $this.attr('href'),
<?php
Route::group(array('prefix' => 'admin'), function() {
Route::get('users', 'AdminUsersController@index');
// Routes GET /admin/users => AdminUsersController#index()
});