Skip to content

Instantly share code, notes, and snippets.

View laurentiuc's full-sized avatar
💭
me.execute( () -> hacking(multiverse) )

Laurentiu laurentiuc

💭
me.execute( () -> hacking(multiverse) )
  • Romania
View GitHub Profile
@laurentiuc
laurentiuc / addThis-directives.js
Last active February 8, 2017 19:29
AngularJS addThis directive
angular.module('myApp').directive('addthisToolbox', ['$timeout', function($timeout) {
return {
restrict : 'A',
transclude : true,
replace : true,
template : '<div ng-transclude></div>',
link : function($scope, element, attrs) {
$timeout(function () {
addthis.init();
addthis.toolbox($(element).get(), {}, {
@laurentiuc
laurentiuc / lambda-redirect-to-trailing-slash.js
Created January 5, 2019 20:27 — forked from nabilfreeman/lambda-redirect-to-trailing-slash.js
Redirect to trailing slashes on CloudFront with AWS Lambda. (all this because S3 uses 302 redirects instead of 301)
'use strict';
const path = require('path')
exports.handler = (event, context, callback) => {
//get request object
const { request } = event.Records[0].cf
const url = request.uri;