Skip to content

Instantly share code, notes, and snippets.

View blpraveen's full-sized avatar

B L Praveen blpraveen

View GitHub Profile
@blpraveen
blpraveen / jquery.serializeObject.js
Last active August 29, 2015 13:57
Jquery SeiralizeObject to convert a form into a Array of Objects
$.fn.serializeObject = function serializeObject() {
var data = {},pushes = {},named = {};
patterns = {
validate: /^[a-z][a-z0-9_-]*(?:\[(?:\d*|[a-z0-9_]+)\])*$/i,
key: /[a-z0-9_-]+|(?=\[\])/gi,
push: /^$/,
fixed: /^\d+$/,
named: /^[a-z0-9_-]+$/i
};
@blpraveen
blpraveen / jquery.json2xml.js
Last active August 29, 2015 13:57
Jquery json2xml convert json object into xml
$.extend({
// converts xml documents and xml text to json object
json2xml: function(jsonObj,config) {
config = config || {};
initConfigDefaults();
var out = parseJSONObject(jsonObj);
return out;
function initConfigDefaults() {
if(config.escapeMode === undefined) {
@blpraveen
blpraveen / jquery.populate.js
Last active August 29, 2015 13:57
Populate field from json Object
$.fn.populate = function populate(value,key) {
var input_fields= $(this),new_value=value;
patterns = {
key: /[a-z0-9_-]+|(?=\[\])/gi,
push: /^$/,
}
input_fields.each(function(i,input_field) {
var val,key = $(input_field).attr('name');
if(new_value instanceof Array) {
@blpraveen
blpraveen / get_combination.php
Created May 28, 2014 04:57
Generate Combinations from sets
function get_combination($array_sets) {
$count = count($array_sets);
if(is_array($array_sets[0]) && $count > 1) {
$first_set = $array_sets[0];
if($count > 2) {
$oth_room_set = get_combinations(array_slice($array_sets, 1));
} else {
$oth_room_set = $array_sets[1];
}
$array_comb = array();
@blpraveen
blpraveen / PageStatusExtension
Created October 9, 2014 11:56
A simple extension for SilverStripe 3.1 that restores the status tag behavior of sapphire framework 2.4. Needs SiteTree::add_extension('PageStatusExtension'); in your config.
class PageStatusExtension extends DataExtension {
private static $db = array(
'Status' => 'Varchar'
);
private static $defaults = array(
"Status" => "New page",
}
public onBeforePublish($original) {
@blpraveen
blpraveen / jquery.tokenize.css
Last active August 29, 2015 14:08
JQuery Tokenizer with Auto Suggested List (Text and Select)
div.TokenizeMeasure,
div.Tokenize ul li span,
div.Tokenize ul.TokensContainer li.TokenSearch input
{
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
div.Tokenize
{
@blpraveen
blpraveen / functions.php
Last active August 29, 2015 14:12
Wordpress MegaMenu
function megamenu_nav_update( $menu_id, $menu_item_db_id ) {
// verify this came from our screen and with proper authorization.
if ( ! isset( $_POST['megamenu-nonce'] ) || ! wp_verify_nonce( $_POST['megamenu-nonce'], 'megamenu-nonce-name' ) )
return;
if(isset($_POST['mega-menu-colopt'][$menu_item_db_id]) && $_POST['mega-menu-colopt'][$menu_item_db_id] != '') {
@blpraveen
blpraveen / README
Last active August 29, 2015 14:24 — forked from joelambert/README
Drop in replace functions for setTimeout() & setInterval() that
make use of requestAnimationFrame() for performance where available
http://www.joelambert.co.uk
Copyright 2011, Joe Lambert.
Free to use under the MIT license.
http://www.opensource.org/licenses/mit-license.php
@blpraveen
blpraveen / m2-install.md
Created May 15, 2021 04:30 — forked from viktorpetryk/m2-install.md
Magento 2 installation on Laragon (Windows 10)
  1. Create root directory for project:
mkdir magento2.test
  1. Cd to created directory:
cd magento2.test
@blpraveen
blpraveen / TypeScript
Created May 29, 2021 16:58
Live Streaming
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Router } from '@angular/router';
import { LoginService, AzureService } from '../services'
import { User, LiveSession } from '../models'
import { SharedService } from "app/services/shared.service";
//declare var SimpleWebRTC;
declare var io;
declare var conference;
@Component({