Skip to content

Instantly share code, notes, and snippets.

View lmammino's full-sized avatar
🦁
Roar!

Luciano Mammino lmammino

🦁
Roar!
View GitHub Profile
<?php
namespace Oinm\ServiceBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
/**
@lmammino
lmammino / UserManager.php
Created September 4, 2011 16:10 — forked from stof/UserManager.php
Logging in by email or username with FOSUserBundle_FIXED
<?php
namespace Acme\UserBundle\Model;
use FOS\UserBundle\Entity\UserManager as BaseUserManager;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
class UserManager extends BaseUserManager
{
public function loadUserByUsername($username)
@lmammino
lmammino / curlStreamedDownload.php
Created December 21, 2012 15:15
Download a large file (streaming) with php and curl extension
<?php
$url = 'http://www.example.com/a-large-file.zip';
$path = '/path/to/a-large-file.zip';
$fp = fopen($path, 'w');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FILE, $fp);
$data = curl_exec($ch);
@lmammino
lmammino / RackspaceAuthenticationCommand.php
Last active December 14, 2015 03:59
Symfony2 command to test rackspace authentication
<?php
namespace Sbaam\Bundle\UtilsBundle\Command;
use Symfony\Component\Console\Command\Command,
Symfony\Component\Console\Input\InputArgument,
Symfony\Component\Console\Input\InputInterface,
Symfony\Component\Console\Input\InputOption,
Symfony\Component\Console\Output\OutputInterface;
@lmammino
lmammino / Gedit-Decrypt-document.sh
Created April 4, 2013 10:03
"Decrypt Document" integration for Gedit (compatible with textmate text encryption/decription)
#!/bin/sh
pw=`zenity --entry --hide-text --title="Encrypt document" --text="Insert key"`;
openssl enc -d -aes128 -base64 -pass "pass:$pw";
@lmammino
lmammino / Gedit-Encrypt-document.sh
Created April 4, 2013 10:04
"Encrypt Document" integration for Gedit (compatible with textmate text encryption/decription)
#!/bin/sh
pw=`zenity --entry --hide-text --title="Encrypt document" --text="Insert key"`;
openssl enc -e -aes128 -base64 -pass "pass:$pw";
@lmammino
lmammino / dropbox
Last active May 10, 2016 12:41
Run dropbox CLI as service
#/etc/init.d/dropbox
start() {
echo "Starting dropbox..."
start-stop-daemon -b -o -c dropbox -S -x /dropbox/.dropbox-dist/dropbox
}
stop() {
echo "Stopping dropbox..."
start-stop-daemon -o -c dropbox -K -x /dropbox/.dropbox-dist/dropbox
@lmammino
lmammino / gen_uuid.php
Created January 31, 2014 12:06
Create unique ids with Php
<?php
function gen_uuid($len=8) {
$hex = md5("yourSaltHere" . uniqid("", true));
$pack = pack('H*', $hex);
$tmp = base64_encode($pack);
$uid = preg_replace("#(*UTF8)[^A-Za-z0-9]#", "", $tmp);
@lmammino
lmammino / Uid.php
Created February 21, 2014 14:55
UidGenerator Class
<?php
namespace LMammino\Generator;
class Uid
{
/**
* @var string
*/
protected $salt;
@lmammino
lmammino / composer.json
Last active August 29, 2015 13:57
Multi curl tests for kriswallsmith/Buzz (ref: https://github.com/kriswallsmith/Buzz/issues/146)
{
"name": "example/multicurl",
"description": "a test with various multi curl libraries",
"require": {
"kriswallsmith/buzz": "dev-master",
"rdlowrey/artax": "dev-master",
"jyggen/curl": "dev-master"
},
"license": "MIT",
"authors": [