Skip to content

Instantly share code, notes, and snippets.

View alexsegura's full-sized avatar
🔥
On fire

Alexandre Segura alexsegura

🔥
On fire
View GitHub Profile
@alexsegura
alexsegura / text.md
Last active September 3, 2018 13:49
Scaleway private server
@alexsegura
alexsegura / README.md
Last active February 1, 2017 18:02
Running Hypothes.is with Docker Compose

Website dev install

Install Docker Compose & VirtualBox.

Clone the Hypothes.is repo and copy the docker-compose.yml file below inside.

Running the databases with Docker.

# Create a Docker machine if needed
@alexsegura
alexsegura / install_certbot.sh
Created December 1, 2016 22:58
Install CertBot on Debian Jessie
echo 'deb http://ftp.debian.org/debian jessie-backports main' >> /etc/apt/sources.list
apt-get update
apt-get install certbot -t jessie-backports
@alexsegura
alexsegura / paymill.php
Created March 31, 2015 14:19
Paymill API pagination
<?php
$api = new Paymill\Request('private_key');
function get_transactions($api, $count, $offset) {
$request = new Paymill\Models\Request\Transaction();
// Other options here
$request->setFilter([
'offset' => $offset,
'count' => $count
@alexsegura
alexsegura / Item.php
Last active January 27, 2019 14:24
Archivable pattern in Doctrine
<?php
use Doctrine\ORM\Mapping as ORM,
Doctrine\ORM\Event\LifecycleEventArgs;
/**
* @ORM\Table(name="item")
* @ORM\HasLifecycleCallbacks
*/
class Item
@alexsegura
alexsegura / xdebug.ini
Created September 10, 2014 08:51
XDebug configuration
[xdebug]
zend_extension=xdebug.so
xdebug.overload_var_dump = 0
xdebug.default_enable = 1
xdebug.idekey = "sublime.xdebug"
xdebug.remote_autostart = 0
xdebug.remote_enable = 1
xdebug.remote_log="/var/log/xdebug/xdebug.log"
xdebug.remote_host=192.168.0.1
@alexsegura
alexsegura / Gruntfile.js
Last active August 29, 2015 14:05
Reloading a Cordova project with Grunt
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
src: {
files: ['www/**/*.html', 'www/**/*.js', 'www/**/*.css'],
tasks: ['shell']
}
},
@alexsegura
alexsegura / gist:9895452
Created March 31, 2014 15:52
Get MySQL error code with Doctrine DBAL
<?php
$sql = '...';
$stmt = $conn->prepare($sql);
try {
$stmt->execute();
} catch (\Doctrine\DBAL\DBALException $e) {
$previous = $e->getPrevious();
@alexsegura
alexsegura / gist:9650651
Last active July 9, 2022 10:41
Prestashop 1.6 folder permissions
chmod a+w -R config/
chmod a+w -R cache/
chmod a+w -R log/
chmod a+w -R img/
chmod a+w -R mails/
chmod a+w -R modules/
chmod a+w -R themes/default-bootstrap/lang/
chmod a+w -R themes/default-bootstrap/pdf/lang/
chmod a+w -R themes/default-bootstrap/cache/
chmod a+w -R translations/
@alexsegura
alexsegura / symfony_forms.php
Last active August 29, 2015 13:56
Creating Symfony Forms with Validation programmatically
<?php
$builder = Validation::createValidatorBuilder();
$builder->addYamlMapping('/path/to/validation.yml');
$validator = $builder->getValidator();
$extensions = array(
new ValidatorExtension($validator)
);