Skip to content

Instantly share code, notes, and snippets.

View jameslkingsley's full-sized avatar

James Kingsley jameslkingsley

View GitHub Profile
@adamwathan
adamwathan / 1-add-macros.php
Last active June 11, 2022 19:55
Multiformat Endpoints in Laravel
<?php
namespace App\Providers;
use Illuminate\Http\Request;
use Illuminate\Routing\Route;
use Illuminate\Support\ServiceProvider;
use App\Http\Middleware\CaptureRequestExtension;
class AppServiceProvider extends ServiceProvider
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Subscriptions - freek@spatie.be</title>
</head>
<body>
<outline text="PHP" title="PHP">
<outline htmlUrl="http://frederickvanbrabant.com" title="frederickvanbrabant.com" xmlUrl="http://frederickvanbrabant.com/feed.xml" type="rss" text="frederickvanbrabant.com"/>
<outline htmlUrl="http://mattallan.org" title="mattallan.org" xmlUrl="http://mattallan.org/feed.xml" type="rss" text="mattallan.org"/>
<outline title="asked.io" xmlUrl="https://asked.io/rss" type="rss" text="asked.io"/>
@adumskis
adumskis / PageController.php
Created February 13, 2017 06:21
Unlimited parameters in route
<?php
public function show($slugs_string){
$slugs = explode('/', $slugs_string);
$page = null;
foreach($slugs as $key => $slug){
$page = Page::where('slug', $slug)
->where('parent_id', '=', is_null($page)?null:$page->id)
->firstOrFail();
@BaerMitUmlaut
BaerMitUmlaut / fnc_onEdenDisplayLoad.sqf
Created October 19, 2016 21:27
Soil icon drawing test
/*
* Author: BaerMitUmlaut
* Adds 2D and 3D UI drawing.
*
* Arguments:
* 0: Eden Display <DISPLAY>
*
* Return Value:
* None
*/
@veselosky
veselosky / s3gzip.py
Last active May 8, 2023 21:42
How to store and retrieve gzip-compressed objects in AWS S3
# vim: set fileencoding=utf-8 :
#
# How to store and retrieve gzip-compressed objects in AWS S3
###########################################################################
#
# Copyright 2015 Vince Veselosky and contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@andyleejordan
andyleejordan / main.cpp
Last active March 20, 2022 15:32
Algorithm for Efficient Chunked File Reading in C++
/* Algorithm for Efficient Chunked File Reading in C++
*
* The MIT License (MIT)
*
* Copyright 2014 Andrew Schwartzmeyer
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
@bennadel
bennadel / code-1.cfm
Created March 25, 2014 00:35
ColdFusion Application.cfc Tutorial And Application.cfc Reference
<cfcomponent
displayname="Application"
output="true"
hint="Handle the application.">
<!--- Set up the application. --->
<cfset THIS.Name = "AppCFC" />
<cfset THIS.ApplicationTimeout = CreateTimeSpan( 0, 0, 1, 0 ) />
<cfset THIS.SessionManagement = true />