Skip to content

Instantly share code, notes, and snippets.

View delineas's full-sized avatar
🚀
Launching...

Daniel Primo delineas

🚀
Launching...
View GitHub Profile
@delineas
delineas / mamp.md
Last active November 3, 2015 19:22 — forked from jfloff/mamp.md
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
delineas / README.md
Created January 5, 2016 08:26 — forked from tjamps/README.md
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. v1.api.example.com)

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

@delineas
delineas / __INDEX.txt
Created June 6, 2017 17:21 — forked from facine/__INDEX.txt
Drupal 8 - Examples
# Taxonomy terms:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_taxonomy_term-php
# Menu links:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_menu_link-php
# File items:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_file-php
# Nodes:
@delineas
delineas / D8.md
Created September 10, 2017 18:58 — forked from leymannx/D8.md

#Drupal 8 snippets

##Create absolute URL:

$options = ['absolute' => TRUE];
$url_object = Drupal\Core\Url::fromRoute('entity.node.canonical', ['node' => $nid], $options);
// will output http://example.com/path-to-my-node

##Create absolute link object (and inner span):

@delineas
delineas / gist:0e3e3f055efdbe696d3a9e7787c64888
Created October 1, 2017 22:54 — forked from remcotolsma/gist:5884430
Gravity Forms calculate number days between 2 date fields
<script type="text/javascript">
jQuery( document ).ready( function( $ ) {
var ms_one_day = 1000 * 60 * 60 * 24;
var form_id = '1';
var date_format = 'dd-mm-yy';
var field_date_start = $( '#input_' + form_id + '_1' );
var field_date_end = $( '#input_' + form_id + '_2' );
@delineas
delineas / fish_shell.md
Created January 12, 2018 20:22 — forked from idleberg/fish_shell.md
Instructions on how to install Fish shell on Mac OS X, including Oh My Fish!. Also includes several useful functions.

Installation

  1. Install fish via Brew
  2. Optionally install Oh My Fish!
  3. Add fish to known shells
  4. Set default shell to fish
brew install fish  
curl -L https://get.oh-my.fish | fish
@delineas
delineas / php-UA.php
Created January 25, 2018 08:56 — forked from walkergv/php-UA.php
Simple Event Tracking with Measurement Protocol Using cURL and PHP (plus redirect)
<?
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'http://www.google-analytics.com/collect?v=1&tid=[UA-XXXXXXXXX-1]&cid=[RANDOM_INTEGER_OR_GUID]&t=event&ec=[EVENT_CATEGORY]&ea=[EVENT_ACTION]&el=[EVENT_LABEL]',
CURLOPT_USERAGENT => 'Vanity-URL-Tracker',
));
$resp = curl_exec($curl);
curl_close($curl);
header("HTTP/1.1 301 Moved Permanently");
@delineas
delineas / mailchimp-subscribe.js
Last active April 30, 2018 17:14 — forked from chrsgrffth/mailchimp-subscribe.coffee
Vue – Mailchimp Subscribe Component
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
// To get the `action` prop:
//
// 1. Go to your dashboard on mailchimp.com and navigate
// to Lists > Signup Forms > Embedded Forms.
//
Twig coding standards
https://www.drupal.org/node/1823416
Filters - Modifying Variables In Twig Templates
https://www.drupal.org/node/2357633
{% for i, value in content.field_app_prod_toggle_products %}
{% if node.field_app_prod_toggle_products[i].entity %}
{% if i == 0 %}
@delineas
delineas / TermBreadcrumbBuilder.php
Created July 16, 2018 19:14 — forked from eeeschwartz/TermBreadcrumbBuilder.php
Load breadcrumbs from a Drupal 8 node's taxonomy term
<?php
/**
* @file
* Contains \Drupal\taxonomy\TermBreadcrumbBuilder.
*/
namespace Drupal\taxonomy;
use Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface;