Skip to content

Instantly share code, notes, and snippets.

View Shaked's full-sized avatar

Shaked Klein Orbach Shaked

View GitHub Profile
@Shaked
Shaked / imgick.opacity.php
Created January 20, 2018 21:00
PHP Imagick replacement for setImageOpacity
<?php
//https://bugs.php.net/bug.php?id=74160
$img = new \Imagick();
$transparent = new \ImagickPixel('#00000000');
$img->readImage($source);
$img->transparentPaintImage(
$transparent,
0.3,
10,
true
@Shaked
Shaked / deploy.php
Created January 13, 2018 15:01
How I manage my cronjobs using deployer.org
<?php
/**
* * * * * "command to be executed"
- - - - -
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
@Shaked
Shaked / README.md
Created December 1, 2017 19:07
In this gist I will try to connect between OpenSeaDragon and KonvaJS. See history for more details

Description

In this gist I will try to connect between OpenSeaDragon and KonvaJS. See history for more details

I have copied OpenSeaDragon's FabricJS plugin implementation in order to create the same plugin for KonvaJS.

Up until now I have only created a working Konva Rect:

.App {
text-align: center;
}
.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 80px;
}
.App-header {
<div id="letters" className="sidebar">
<nav>
<ul onTouchMove={(e) => this.handleOnTouchMove(e)}>{allLettersRows}</ul>
</nav>
</div>
handleOnTouchMove(e, a) {
e.preventDefault();
console.log('handleOnTouchMove', e.targetTouches[0], a);
var letterEl = document.elementFromPoint(
@Shaked
Shaked / Example of Requests
Last active July 24, 2020 23:34
Facebook Messenger Platform Webhook Duplicated Messages Bug
sleep_2
TheProcess
blah answer from http request: hello from http request
FB REQUEST: {"object":"page","entry":[{"id":"1637124163250118","time":1510609445717,"messaging":[{"sender":{"id":"1522824674478341"},"recipient":{"id":"1637124163250118"},"timestamp":1510609444865,"message":{"mid":"mid.$cAAXQ9Ib_cmJl6JwoAVft1bfqtwNH","seq":622503,"text":"sleep_2"}}]}]}
Shaked
sleep_21
TheProcess
blah answer from http request: hello from http request
@Shaked
Shaked / mouseMovingLines.js
Created October 27, 2017 22:43
Create a horizontal & vertical lines attached to mouse move with KonvaJS
var mouseMovingLines = {
enabled: true,
drawn: false,
xaxisLine: null,
yaxisLine: null,
stage: null,
layer: null,
init: function(stage, layer, options) {
this.options = $.extend({
strokeColor: "#fff",
@Shaked
Shaked / README.md
Created October 18, 2017 20:54
Facebook Duplicate Messages Possible Fix

Description

I have been facing a problem where I got duplicate messages from Messenger's API while developing a chatbot.

I have been looking for a solution and tweeted for help. At the end I got to the following explanation:

Duplicate message postbacks is almost always because fb didn't hear a 200 response and the request ending soon enough. Depending on your language this could be tricky. In php for example not only do you have to respond with 200 ok early, you have to actively clear the buffer and end the connection for fb to receive the response. (Then you can do more processing if needed). Other languages may have something similar.

as mentioned here.

@Shaked
Shaked / README.md
Last active February 3, 2018 15:03
PHP Google Spreadsheet Integration via CLI