Skip to content

Instantly share code, notes, and snippets.

@drinks
drinks / deploy.rb
Created October 11, 2012 21:33
Cap recipe for wordpress using nginx, php-fpm and W3 Total Cache
default_run_options[:pty] = true
set :application, "<your-application-folder-name>"
set :domain, "<your-ip-addr>"
set :user, "<your-deploy-user>"
set :group, "<your-deploy-group>"
set :runner, "<your-deploy-user>"
set :use_sudo, true
set :scm, :git
set :deploy_via, :remote_cache
set :repository, "git@github.com:your-account/your-repo.git"
@chanmix51
chanmix51 / create-pomm-silex.sh
Last active February 25, 2018 17:11
Silex project bootstrap with Pomm
#!/bin/bash
mkdir -p bin sources/{config,twig,sql,lib/{Model,Controller}} web/{css,images,js} tests documentation log
chmod 777 log
> web/favicon.ico
cat > bin/generate_model.php <<"EOF"
<?php // bin/generate_model.php
$app = require(__DIR__."/../sources/bootstrap.php");
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@kriswallsmith
kriswallsmith / QSAListener.php
Created August 8, 2012 18:23
implements QSA on Symfony2 redirects
<?php
use JMS\DiExtraBundle\Annotation as DI;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
/** @DI\Service */
class QSAListener
{
private $blacklist;
@n1k0
n1k0 / include.js
Created December 22, 2011 08:24
Simple javascript include
function include(url) {
var element;
switch (url.split(".").pop()) {
case "css":
{
element = document.createElement("link");
element.setAttribute("rel", "stylesheet");
element.setAttribute("type", "text/css")
element.setAttribute("href", url)
}
<?php
mysql_connect('localhost', 'root', '') or
die('cannot connect : ' . mysql_error());
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style type="text/css">
body { font-family: arial, helvetica, sans-serif; font-size: 10pt; margin: 0; }
table { border-collapse: collapse; margin: auto; }
@pborreli
pborreli / import
Created May 10, 2010 14:42
Dealing with mass import in doctrine/pdo using pcntl_fork
<?php
class importTask extends sfTask
{
protected function execute($arguments = array(), $options = array())
{
$xml = simplexml_load_file('file');
$users = array();
foreach ($xml->users as $user)
{