Skip to content

Instantly share code, notes, and snippets.

View pedrorocha-net's full-sized avatar

Pedro Rocha pedrorocha-net

  • Lisboa, Portugal
View GitHub Profile
@pedrorocha-net
pedrorocha-net / NumberAbbrevFilter.coffee
Created October 29, 2014 18:47
Angular JS Filter for Number Abbreviation
"use strict"
@Application = angular.module("numberAbbrevFilter", [])
@Application.filter "numberAbbrev", ->
(number) ->
if number >= 10000000
return (number / 1000000).toFixed(0) + 'M'
@pedrorocha-net
pedrorocha-net / MyPage.php
Last active August 14, 2016 22:06
Example of page route in Drupal, with the Cool module
<?php
namespace Drupal\my_page\PageControllers;
class MyPage implements \Drupal\cool\Controllers\PageController {
public static function accessCallback() {
return TRUE;
}
api = 2
core = 7.x
; Include the definition of how to build Drupal core directly, including patches.
includes[] = "drupal-org-core.make"
; Download the Commons install profile and recursively build all its dependencies.
projects[taz][type] = "profile"
projects[taz][download][type] = "git"
projects[taz][download][url] = "https://github.com/alexweber/Taz.git"
@pedrorocha-net
pedrorocha-net / gist:4708132
Created February 4, 2013 17:23
Exemplo de Integração do módulo de Drupal http://drupal.org/project/pagseguro, para integrar ao PagSeguro puramente, sem estar dentro de um ecommerce
pagseguro_library_load();
$PagSeguroAPI = new PagSeguroAPI();
$payment_request = $PagSeguroAPI->createPaymentRequestObject();
$payment_request->setCurrency("BRL");
$payment_request->setReference($order_reference);
$payment_request->setSender($customer_name, $order->mail);
$payment_request->setRedirectUrl("http://example.com/pagseguro/return");
// Shipping rate is handled by Drupal