Skip to content

Instantly share code, notes, and snippets.


Daniel Primo delineas

View GitHub Profile
View gist:10545003
### Keybase proof
I hereby claim:
* I am delineas on github.
* I am delineas ( on keybase.
* I have a public key whose fingerprint is DDA9 FC8B E52C 5412 5E52 C256 BA12 F30A 4647 1FF5
To claim this, I am signing this object:
View Parser.php
namespace Acme;
* Dummy class
class Parser
delineas / controller.php
Created Jun 11, 2015
Silex CSV generator
View controller.php
$app->match('/export', function() use($app) {
$records = $app['db']->fetchAll("SELECT * FROM formdata");
$file = "/tmp/formdata.csv";
$output = fopen($file, "w");
fputcsv($output, array('name','surname','province'), ',');
foreach ($records as $row)
fputcsv($output, $row, ',');
delineas / template-full-width.php
Created Oct 13, 2015
Wordpress Select dropdown filter by month
View template-full-width.php
// /wp-content/themes/Karma/template-full-width.php
// Below line #41 <main role="main" id="content" class="content_full_width">
<div class="select-archive-dropdown" style=“text-align: right;margin-bottom: 15px;”><select name="archive-dropdown" onChange='document.location.href=this.options[this.selectedIndex].value;'>
<option value=""><?php echo attribute_escape(__('Select Month')); ?></option>
<?php wp_get_archives('type=monthly&format=option&show_post_count=1'); ?> </select>
delineas /
Last active Nov 3, 2015 — forked from jfloff/
How to get MAMP to work with SSL ... Yes really.

First of all you need to be able to run MAMP in port 80. This is a "heat check" if you don't have any process jamming http ports. You can check it like this:

sudo lsof | grep LISTEN

If you do happen to have any process with something like this *:http (LISTEN), you are in trouble. Before with adventure check if it isn't MAMP itself (yeah, you should close that beforehand)

ps <pid of that process>

If you don't see MAMP, you are in good hands, I have just the thing for you:

delineas / command-line-sips.bash
Created Nov 4, 2015
Resize JPG images with sips command line Mac OS X
View command-line-sips.bash
find /path/to/images -type f -name '*.jpg' -exec sips --resampleHeightWidthMax 800 --setProperty formatOptions 50 *.jpg {} \;
delineas / UserMigration.php
Created Nov 9, 2015
OroCRM example for user migration
View UserMigration.php
namespace Ecowala\UserCRMBundle\Migrations\Schema\v1_1;
use Doctrine\DBAL\Schema\Schema;
use Oro\Bundle\EntityExtendBundle\EntityConfig\ExtendScope;
use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migration\QueryBag;
class UserMigration implements Migration
delineas / settings.local.php
Created Dec 15, 2015
Drupal git branch different database
View settings.local.php
$databases = array (
'default' =>
array (
'default' =>
array (
'driver' => 'mysql',
'username' => 'root',
'password' => 'root',
'port' => '',
delineas / eval_code.php
Created Dec 21, 2015
Drupal 7 Panels Visibility Rule: Body Content Counts More 1000 Chars
View eval_code.php
// Insert in input box without <?php tags
if(strlen(strip_tags($contexts['argument_entity_id:node_1']->data->body['und'][0]['value'])) > 1000 ) {
return TRUE;
else {
return FALSE;
delineas /
Created Jan 5, 2016 — forked from tjamps/
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g.

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :

You can’t perform that action at this time.