Skip to content

Instantly share code, notes, and snippets.

View cagataygurturk's full-sized avatar

Çağatay Gürtürk cagataygurturk

View GitHub Profile
@cagataygurturk
cagataygurturk / gist:cbe06116714419931e33
Created December 22, 2014 19:15
Image resize on Imagick
<?php
$thumb = new \Imagick();
$thumb->readimageblob($imagedata['data']);
$thumb->cropThumbnailImage($d->getWidth(), $d->getHeight());
$output = $thumb->getimageblob();
@cagataygurturk
cagataygurturk / gist:1421734eafb6b1e24424
Created December 22, 2014 19:18
Image resize on GD
<?php
$gdthumb = new \PHPThumb\GD($imagedata['data']);
$gdthumb->setOptions(array(
'interlace' => false
));
$gdthumb->adaptiveResizeQuadrant($d->getWidth(), $d->getHeight());
$output = $gdthumb->getImageAsString();
@cagataygurturk
cagataygurturk / instela-share-button
Last active August 29, 2015 14:21
Instela share button
<a href="https://tr.instela.com" class="instela-share">instela'da paylaş</a>
<script>!function(d, s, id) {var js, ijs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';if (!d.getElementById(id)) {js = d.createElement(s);js.id = id;js.src = p + '://widgets.instela.com/instela.js';ijs.parentNode.insertBefore(js, ijs);}}(document, 'script', 'instela-sjs');
</script>
@cagataygurturk
cagataygurturk / debug.js
Created February 18, 2016 13:06
Lambda debug locally
/**
* Used to debug locally node.js files
*
* Usage:
*
* node debug.js function_to_run.js event_file.json
*
* Make sure that you have dotenv in package json for environment support.
*/
require('dotenv').config();
/**
* Facebook Chat SDK that tells you the hour
*/
var request = require("request");
var page_token = "page_token";
module.exports.respond = function (event, cb) {
$('*[data-poload]').hover(function() {
var e = $(this);
e.off('hover');
$.get(e.data('poload'), function(d) {
e.popover({
content: d
}).popover('show');
});
});
<?php
public function onBootstrap(EventInterface $e){
$em = $e->getApplication()->getEventManager();
$em->attach(MvcEvent::EVENT_ROUTE, array(
$this,
'detachNotFoundStrategy'
) , 1);
}
@GET
@Path("/helloworld/{id}")
public Response indexEndpoint(@PathParam int id) {
return Response.status(200).entity("Hello world: " + id).build();
}
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"cloudformation:*",
"s3:*",
"lambda:*",
"execute-api:*",
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"cloudformation:*",
"s3:*",
"lambda:*",
"execute-api:*",