Skip to content

Instantly share code, notes, and snippets.

View silasrm's full-sized avatar

Silas Ribas Martins silasrm

View GitHub Profile
@terenceponce
terenceponce / instructions.md
Created September 26, 2012 08:25
Setting up Thinking-Sphinx on Mac OS X using Homebrew

Out of the box, Homebrew does a default installation on Sphinx:

$ brew install sphinx

However, if you're using MySQL, the thinking-sphinx gem won't work because it needs to use MySQL libraries.

If you managed to screw up the first time, uninstall sphinx first:

$ brew remove sphinx

@donamkhanh
donamkhanh / gist:3800862
Created September 28, 2012 16:43
Set up multiple database in Zend Framework (v1.12)
1) Setup multiple DB in application.ini like this:
; Database 1
resources.multidb.db1.adapter = pdo_mysql
resources.multidb.db1.host = 127.0.0.1
resources.multidb.db1.username = root
resources.multidb.db1.password = vertrigo
resources.multidb.db1.dbname = my_db_1
resources.multidb.db1.default = true
; Database 2
@fideloper
fideloper / sphinx.conf
Created October 3, 2012 01:15
Install Sphinx and php .so in Ubuntu 12.04
#############################################################################
## data source definitions
#############################################################################
source users
{
# data source type. mandatory, no default value
# known types are mysql, pgsql, mssql, xmlpipe, xmlpipe2, odbc
type = mysql
@solar
solar / install.sh
Created October 16, 2012 10:47
install redis with supervisord
#!/bin/sh
version="2.6.3"
priority="20603"
sudo mkdir -p /var/redis /var/log/redis
curl -sL http://redis.googlecode.com/files/redis-${version}.tar.gz | tar zx
cd redis-${version}/
make
sudo make PREFIX=/usr/local/redis/${version} install
@maccath
maccath / gist:3981205
Created October 30, 2012 16:09
Split PDF to individual pages using FPDI and FPDF
<?php
/**
* Split PDF file
*
* <p>Split all of the pages from a larger PDF files into
* single-page PDF files.</p>
*
* @package FPDF required http://www.fpdf.org/
* @package FPDI required http://www.setasign.de/products/pdf-php-solutions/fpdi/
@abulte
abulte / rethindb_ip_whitelist.sh
Created December 7, 2012 13:07
RethinkDB IP whitelist on service ports
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
# set default policies to allow everything
# this should be DROP by default but out of scope...
iptables -P INPUT ACCEPT
@danvbe
danvbe / 1-Explanations.md
Last active July 23, 2025 05:55
A way to integrate FosUserBundle and HWIOAuthBundle

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

  1. Routing. In routing.yml I have added all the routes for both bundles.
  2. Configuration. I have set the config.yml mostly as it is presented in the HWIOAuthBundle.
  3. Security. I have set the security.yml mostly as it is presented in the HWIOAuthBundle (though my routes are using /login pattern, not /connect). Also, the oauth_user_provider is set for my custom service.
@wwdboer
wwdboer / gist:4943672
Created February 13, 2013 10:27
PHP: Get Vimeo ID
function get_vimeoid( $url ) {
$regex = '~
# Match Vimeo link and embed code
(?:<iframe [^>]*src=")? # If iframe match up to first quote of src
(?: # Group vimeo url
https?:\/\/ # Either http or https
(?:[\w]+\.)* # Optional subdomains
vimeo\.com # Match vimeo.com
(?:[\/\w]*\/videos?)? # Optional video sub directory this handles groups links also
\/ # Slash before Id
@alganet
alganet / php_pratico_streams.md
Last active August 15, 2021 20:41
PHP Prático: Streams

PHP Prático: Streams

A palavra stream significa corrente. Em geral, qualquer conexão de rede é uma stream, e existem vários tipos de protocolos para streams. Esses protocolos definem como os dados fluem na corrente.

No PHP, vários protocolos são suportados de forma transparente:

<?php
@alganet
alganet / streams_respect.md
Last active July 3, 2020 18:50
Respect Prático: Streams

Respect Prático: Streams

Agora que você já viu como trabalhar com streams no PHP, vou mostrar um pouco do suporte a streams do Respect!

Respect\Rest

O Respect\Rest foi o primeiro projeto PHP a suportar o controle de rotas com streaming e é o mais completo nisso. Fazer o stream de qualquer coisa é simples.