Skip to content

Instantly share code, notes, and snippets.

@alexbilbie
alexbilbie / README.md
Last active August 29, 2015 14:11
StackPHP basic API versioned routes example

Setup

$ composer install
$ php -S localhost:8000

Version 1.0 call:

curl -X "GET" "http://localhost:8000/index.php/foo" -H "Accept: 1.0"

<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Jean-Pierre subscriptions in feedly Cloud</title>
</head>
<body>
<outline text="innovation" title="innovation">
<outline type="rss" text="Pl4n3s world" title="Pl4n3s world" xmlUrl="http://pl4n3.blogspot.com/feeds/posts/default?alt=rss" htmlUrl="http://pl4n3.blogspot.com/"/>
<outline type="rss" text="Mozilla Hacks - the Web developer blog" title="Mozilla Hacks - the Web developer blog" xmlUrl="http://hacks.mozilla.org/feed/" htmlUrl="https://hacks.mozilla.org"/>
@devgeek27
devgeek27 / laravel.sh
Last active January 10, 2016 23:38
Create new project for Laravel 5
#!/bin/sh
# Get the project name
PROJECT_NAME=${1:-laravel}
# Install Laravel
laravel new $PROJECT_NAME
# Change to the project directory
cd $PROJECT_NAME
class MoneyType extends AbstractType implements DataMapperInterface
{
public function buildForm(FormBuilder $builder, array $options)
{
$builder
->add('amount', 'integer')
->add('currency', 'string')
->setDataMapper($this)
;
}
PHP Extensions Tutorial
The best way to learn about writing extensions is - to write an
extension! If you want to "code along", you'll need to be set up to
compile PHP 7 extensions, have a checkout of the example code we'll be
using, and have the C library we'll be "wrapping" available on your
system.
All the code we'll be working with is available from
https://github.com/auroraeosrose/php-extensions-code
@paragonie-scott
paragonie-scott / crypto-fails.md
Last active March 26, 2017 14:04
Don't use the OWASP PHP Crypto Library
@gnugat
gnugat / StackRollback.php
Last active May 12, 2017 09:24
A Middleware preventing Doctrine DBAL to change the database, useful for tests
<?php
namespace Gnugat\StackRollback;
use Doctrine\DBAL\Connection;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;
/**
* Example:
parameters:
file_upload_mime_types:
- application/pdf
- application/x-pdf
- text/plain
- application/rtf
- image/*
- application/msword
- application/vnd.openxmlformats-officedocument.wordprocessingml.document
@calebporzio
calebporzio / fa.sublime_snippet
Last active April 8, 2018 01:34
Font Awesome sublime snippet for creating icon tags
<snippet>
<content><![CDATA[
<i class="fa fa-fw fa-${1}"></i>&nbsp;
]]></content>
<tabTrigger>fa</tabTrigger>
<description>Font Awesome Icon</description>
<scope>text.blade, text.html.blade, text.html</scope>
</snippet>
@mrkrstphr
mrkrstphr / README.md
Last active February 5, 2019 13:17
Deploying Sculpin Sites to GitHub Pages

Deploying Sculpin Sites to GitHub Pages

I wanted to be able to use Sculpin to generate GitHub pages. Here's what I did...

  1. Created a super awesome Sculpin site from the Sculpin Blog Skeleton

  2. Make sure everything is under version control in my master branch (except things that shouldn't be. see the .gitignore)

  3. Updated publish.sh:

#!/bin/bash