Skip to content

Instantly share code, notes, and snippets.

@obiPlabon
obiPlabon / উত্তরাধিকার.js
Last active January 26, 2017 12:07
Code snippet from http://উত্তরাধিকার.বাংলা/
/**
* Code snippet from http://উত্তরাধিকার.বাংলা/
*
* Really inspiring if you wanna know code smell
* and how to write bad code
*/
function determine_ashaba(sel_rel_arr,ashabas_from_qh,exclude_from_qh,qhs)
{
var ashabas = [];
@obiPlabon
obiPlabon / vc-js-events.js
Last active October 5, 2019 12:46
List of some Visual Composer JS events
// Fixed named events
var _events = [
"vc:access:initialize",
"vc:access:backend:ready",
"shortcodes:vc_row:add:param:name:parallax",
"shortcodes:vc_row:update:param:name:parallax",
"shortcodes:vc_single_image:sync",
"shortcodes:vc_single_image:add",
"shortcodes:add:param:type:el_id",
"click:media_editor:add_image",
/* =========================================================
* composer-view.js v0.2.1
* =========================================================
* Copyright 2013 Wpbakery
*
* Visual composer backbone/underscore version
* ========================================================= */
(function ( $ ) {
var i18n = window.i18nLocale,
store = vc.storage,
@obiPlabon
obiPlabon / custom_view.js
Created January 2, 2017 13:42 — forked from pavelthq/custom_view.js
Visual Composer: Custom markup element example
window.VcCustomElementView = vc.shortcode_view.extend( {
elementTemplate: false,
$wrapper: false,
changeShortcodeParams: function ( model ) {
var params;
window.VcCustomElementView.__super__.changeShortcodeParams.call( this, model );
params = _.extend( {}, model.get( 'params' ) );
if ( ! this.elementTemplate ) {
this.elementTemplate = this.$el.find( '.vc_custom-element-container' ).html();
@obiPlabon
obiPlabon / vc-parent-child-communication.js
Last active April 8, 2026 18:17
Parent to child and child to parent (bidirectional) communication in Visual Composer shortcode
/**
NOTES:
========================
0. Extend container view from "VcColumnView" so that you get a clean UI.
1. Render method called after element is added (cloned), and on first initalization.
2. Use model.getParam(param_name) to get specific param from params.
3. Use model.get("params") to get complete params object.
4. If params is changed then shortcode will be rendered automatically.
5. You do not need to override method that you are not going change, in our file "render".
**/
@obiPlabon
obiPlabon / array-mapx.php
Created January 15, 2017 17:33
PHP custom array mapping function which supports key/index
<?php
/**
* PHP default array map function doesn't provide access to array item key
* So there is no way to map array based on some condition which depends on
* array item key. And that's why array_mapx is here to help you in that case.
* @param array $arr Array that is going to be mapped
* @param callable $callback Callback function to map array $a
* @param boolean $preserve_keys To maintain the old keys
* @return array Mapped array
*/
@obiPlabon
obiPlabon / non-semantic.html
Created January 22, 2017 05:41
Simple difference between Semanctic, Partial Semanctic and Non Semantic markup
<div class="article">
<div class="heading">Article Heading</div>
<div class="article-content">
<div class="paragraph">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
</div>
<div class="paragraph">
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
/* global jQuery, wp */
jQuery( function( $ ) {
var initializeAllClocks, initializeClock;
/**
* Find clocks.
*
* @param [container] Scoping element for finding clock elements.
* @returns {void}
@obiPlabon
obiPlabon / functions.php
Created February 6, 2017 15:20 — forked from EmranAhmed/functions.php
Hook Info. Get Action hook info. What functions are hooked to an action / filter in WordPress? How can I see all the actions attached to an "add_action" hook?
<?php
if ( ! function_exists( 'hippo_plugin_hook_info' ) ):
function hippo_plugin_hook_info( $hook_name ) {
global $wp_filter;
$docs = array();
$template = "\t - %s Priority - %s.\n\tin file %s #%s\n\n";
echo '<pre>';
/**
* Figure out unique numbers from an array
*
*/
#include <stdio.h>
int main()
{
int arr[10], arr_size;