Skip to content

Instantly share code, notes, and snippets.

View simensen's full-sized avatar
🎯
Focusing

Beau Simensen simensen

🎯
Focusing
View GitHub Profile
@tillkruss
tillkruss / app\Http\Kernel.php
Last active March 9, 2023 14:26
Running Laravel 5 on Heroku behind CloudFlare
<?php
class Kernel extends HttpKernel
{
protected $middleware = [
\App\Http\Middleware\TrustedProxies::class,
];
}
@ePirat
ePirat / Parser.js
Created January 16, 2013 21:12
Link header parser (JavaScript)
var PageLinks = function(linkHeader) {
var ProfileRel = "https://tent.io/rels/profile";
var final = [];
var links = linkHeader.split(",");
if (links.length < 2)
links[0] = linkHeader;
for (link in links) {
link = links[link];
var segments = link.split(";");
if (segments.length < 2)
@davedevelopment
davedevelopment / index.php
Created November 13, 2012 16:36
Tinkering with a Hal resource DTO, separating the framework from the app and content negotiation
<?php
namespace Demo {
require __DIR__."/vendor/autoload.php";
use Nocarrier\Hal;
class Resource extends Hal {}
class ResourceResponse
@igorw
igorw / gist:2145730
Last active May 22, 2023 13:23
Composer PR Template

Composer is a new dependency manager for PHP. It allows you to specify dependencies on a per-project basis. It takes lots of inspiration from NPM and ruby's bundler.

All you need to support composer is a composer.json file. In order to allow easy installation, the repository needs to be added to packagist, which is the standard repository for composer. Packagist will fetch all the versions from your github repository tags.

Once it has been added, adding {PROJECT} to a project will be as easy as creating this composer.json file in the project's directory:

{
    "require": {
        "{VENDOR}/{PROJECT}": "{VERSION}"

}

@mgwilliams
mgwilliams / hiera.py
Created February 22, 2012 22:07
Python script to access data from hiera...
from subprocess import check_output
import json
import collections
def hiera(key, environment, location, hostname, merge=None, preserve_order=True, bin="/usr/local/bin/hiera", confdir="/etc/puppet/"):
if preserve_order:
obj_pair_hook=collections.OrderedDict
else:
obj_pair_hook=None
@eykd
eykd / .gitignore
Created January 19, 2012 04:37
Full stack BDD testing with Behave+Mechanize+Django
*.pyc
bin/
include/
lib/
@smoak
smoak / TwistedStuff.py
Created May 18, 2011 00:38
Twisted Stuff
from twisted.internet import reactor, defer
class Api:
def __init__(self):
self.domainObjects = None
self.subscribers = []
def test(self, url):
# code for doing the async stuff here
@desandro
desandro / jquery.imagesloaded.js
Created January 26, 2011 18:01 — forked from paulirish/README.md
$.fn.imagesLoaded jQuery plugin
// $('img.photo',this).imagesLoaded(myFunction)
// execute a callback when all images have loaded.
// needed because .load() doesn't work on cached images
// Modified with a two-pass approach to changing image
// src. First, the proxy imagedata is set, which leads
// to the first callback being triggered, which resets
// imagedata to the original src, which fires the final,
// user defined callback.
@haraldmartin
haraldmartin / Set active Time Machine Disk.applescript
Created November 27, 2010 16:18
Set active Time Machine Disk
property pth : (path to preferences folder from local domain) as text
property d1name : "WD My Book"
property d1 : "com.apple.TimeMachine RF9.plist"
property d2name : "AirDisk"
property d2 : "com.apple.TimeMachine Home.plist"
property active : "com.apple.TimeMachine.plist"
@ilkka
ilkka / tag_cloud_tag.rb
Created November 22, 2010 20:07
Jekyll tag cloud / tag pages plugin
module Jekyll
class TagCloudTag < Liquid::Tag
safe = true
def initialize(tag_name, text, tokens)
super
end
def render(context)
html = ""