Skip to content

Instantly share code, notes, and snippets.


Ali N. nadalizadeh

View GitHub Profile
nadalizadeh / CustomSelectDecorator.php
Last active Jun 15, 2017
SELECT....FOR UPDATE hack in Zend Framework 2 (ZF2)
View CustomSelectDecorator.php
/* Adjust namespace with your own code */
namespace Data;
use Zend\Db\Adapter\Driver\DriverInterface;
use Zend\Db\Adapter\ParameterContainer;
use Zend\Db\Adapter\Platform\PlatformInterface;
use Zend\Db\Sql\Platform\Mysql\SelectDecorator;
class CustomSelectDecorator extends SelectDecorator {
nadalizadeh /
Last active Oct 20, 2020
Read and Write Thrift Encoded Buffers in node.js
var thrift = require('thrift')
var ttypes = require('./gen-nodejs/serialization_types') // Replace it with your own ttypes generated file
// Use frame transport to read
var Transport = thrift.TFramedTransport
var Protocol = thrift.TCompactProtocol
// packet.payload is the thrift encoded data we have received
var bufTrans = new Transport(packet.payload)
var myprot = new Protocol(bufTrans)