Skip to content

Instantly share code, notes, and snippets.

View pramendra's full-sized avatar
💭
🤓

Pramendra Gupta pramendra

💭
🤓
View GitHub Profile
<?php
namespace MyNamespace\Mvc\Controller;
use Zend\Mvc\MvcEvent,
Zend\View\Model\ViewModel,
Zend\Date\Date,
MyNamespace\Exception\InvalidArgumentException;
class ActionController extends \Zend\Mvc\Controller\ActionController
<?php
namespace User\Form\Student;
use Zend\Form\Form;
use Zend\Stdlib\Hydrator\ClassMethods as ClassMethodsHydrator;
class EditSkills extends Form
{
public function __construct()
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/query.php
*/
$args = array(

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

@pramendra
pramendra / gist:567b894a2ee0fa42487d
Created October 8, 2014 06:06
Client side Javascript Error Tracking using GTM (google analytics)
/**
* Track JS error details in Universal Analytics
*/
function trackJavaScriptError(e) {
var errMsg = e.message;
var errSrc = e.filename + ': ' + e.lineno;
ga('send', 'event', 'JavaScript Error', errMsg, errSrc, { 'nonInteraction': 1 });
}
import React, { PropTypes } from 'react';
import { View } from 'react-native';
const Renderer = (props) => {
if (props.isRefreshed === false) return props.loadingComponent;
return (
<View style={{ flex: 1 }}>
{(props.isRefreshed && props.isZeroState === true)
? props.zeroStateComponent : props.children}
</View>
@pramendra
pramendra / Array To Chunks
Created June 7, 2017 09:03
Convert Array to Array chunks - ES6
const arrayToChunks = (arrayData, length = 2) => {
const ImmutateArrayData = [...arrayData];
let chunks = [];
while(([...data] = ImmutateArrayData.splice(0, length)).length !== 0){
chunks.push(data);
}
return chunks;
}
const ab = [1, 2, 3, 4, 5, 6, 7];
<?php
$picker = function ($item) {
return $item;
};
function arrayImplodeIntoString(array $list, $picker, string $separator = ',') :string
{
$first_element = $list[0]??null;
if ($first_element) {
$remaining_list = array_slice($list, 1);
[
{
"id": 1517441231,
"price": 31,
"image_src":
"https://static-mercariapp-com.akamaized.net/thumb/photos/m62013065965_1.jpg?1517441231",
"name": "BH Cosmetics- Wild &amp; Alluring Palette"
},
{
"id": 1517540022,