Skip to content

Instantly share code, notes, and snippets.

@flevour
flevour / ses.py
Created September 15, 2016 13:33
Small integration class for `python-emails`
class SendmailViaSES(object):
def sendmail(self, from_addr, to_addrs, msg, **kwargs):
return ses.send_email(
Source=from_addr,
Destination={
'ToAddresses': to_addrs,
},
Message={
'Subject': {
@flevour
flevour / universal-module.js
Created November 23, 2012 08:25 — forked from millermedeiros/universal-module.js
Universal JavaScript Module, supports AMD (RequireJS), Node.js, and the browser.
/*jslint plusplus: true */
/*global define: false, require: false, module: false, exports: false */
(function (root, name, deps, factory) {
"use strict";
if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like enviroments that support module.exports,
// like Node.
module.exports = factory.apply(root, deps.map(require));
} else if (typeof define === 'function' && define.amd) {
[alias]
st = status
br = branch
co = checkout
unstage = reset HEAD
# http://www.jukie.net/bart/blog/git-amend
amend = commit --amend -C HEAD
[color]
ui = auto
@flevour
flevour / mysql-magic-copy-db.sh
Created September 26, 2012 15:37
Copy MySQL db without dump - Drupal specific version (contains a little fix for users table)
#!/bin/bash
# Credits: http://stackoverflow.com/a/1995186/213903
DBUSER=user
DBPASSWORD=pass
DBSNAME=sourceDb
DBNAME=destinationDb
DBSERVER=servername
fCreateTable=""
@flevour
flevour / index.php
Created September 10, 2012 09:17
file di index
<?php
use ActiveRecord\Config;
require_once 'vendor/autoload.php';
$cfg = Config::instance();
echo 'ok';
@flevour
flevour / 01_example.php
Created March 28, 2012 10:13
Xml SAX implementation example
<?php
$reader = new ExampleDataSource("posts.xml");
foreach ($reader as $post) {
// $post e' un array con chiavi 'title' e 'body'
}
$conf = array(
'cache' => 0,
// 'preprocess_css' => 1,
// 'preprocess_js' => 0,
);
@flevour
flevour / log-week-50.txt
Created December 15, 2011 17:36
IRC Meeting Week 50
[17:22] Stof: flevour: no, that means that the code using equals will be refactored to move the logic out of the User class
[17:22] drak: hi Fabien :)
[17:22] Stof: so no method in UserInterface
[17:22] fabpot: sorry for being late, I totally forgot about the meeting
[17:22] drak: you were just in time, they were about to cancel :)
[17:23] fabpot: have you started yet?
[17:23] flevour: fabpot: lukas won't be here as per https://twitter.com/lsmith/status/147348424755396609 , but we can go through the topics he indicated anyway, what do you think?
[17:24] fabpot: yep, lzt's start
[17:24] flevour: ok, first topic is [FrameworkBundle] added ability to have async/sync render tags http://goo.gl/7bAk8
@flevour
flevour / doctrineClearDb.class.php
Created August 18, 2011 16:27
Truncate all tables of a Doctrine Connection
<?php
class doctrineClearDbTask extends sfBaseTask
{
protected function configure()
{
$this->addOptions(array(
new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name', 'frontend'),
new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'doctrine'),
@flevour
flevour / CreateTable.php
Created July 5, 2011 19:38
Create a table programmatically with Doctrine1
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class InstallSearchData
{
protected $connection = NULL;
public function __construct(Doctrine_Connection $connection)
{