Skip to content

Instantly share code, notes, and snippets.

View shardiwal's full-sized avatar

Rakesh Kumar Shardiwal shardiwal

  • Fagbokforlaget V&B AS
  • Gurgaon, Haryana
View GitHub Profile
async findContentTypeVideos(ctx) {
let content = await this.findSingle(ctx);
let videoContentTypes = [];
let units = content.units;
if ( units ) {
units.forEach( async function(unit) {
let unit_content = unit.content;
if ( unit_content ) {
unit_content.forEach(function(uc) {
if ( uc.video_type ) {
<?php
/**
* @file
* kensium_bootstrap bootstrap sub-theme.
*
* Place your custom PHP code in this file.
*/
function kensium_bootstrap_preprocess_page(&$variables) {
Portfolio->context->run(sub {
# Create a users for testing purposes
my $admin = Portfolio::User->new();
$admin->nickname('t120_available_course_ui_user');
[% FOREACH rec IN StratawareInfo_Profile %]
<div class="row table-list table-strip document-list">
<table class="info-table table limit_4" id="[% rec.recid %]">
<thead>
<tr>
<th colspan="2">[% c.loc(rec.nametype) %] - [% IF rec.addresstype.match('Board') %] [%- c.loc('Board member contact details') -%] [% ELSE %] [% c.loc(rec.addresstype) %] [% END %]</option</th>
</tr>
</thead>
<tbody>
<tr>
@shardiwal
shardiwal / exportTableToCSV.js
Created January 23, 2017 08:51
exportTableToCSV
function exportTableToCSV($table, filename) {
var $rows = $table.find('tr:has(th),tr:has(td)'),
tmpColDelim = String.fromCharCode(11), // vertical tab character
tmpRowDelim = String.fromCharCode(0), // null character
colDelim = '","',
rowDelim = '"\r\n"',
@shardiwal
shardiwal / CandidateCode.java
Last active August 14, 2016 08:08
There are two children harry and garry. Harry is having some coins of value a and garry is having some coins of value b (a and b are positive numbers). They want to get the greatest common divisor d of a and b by adding or subtracting multiples of these two coins. let us say that a = 25 and b=45 then their gcd is 5 and 5 = 2×25 - 45 i.e. gcd can…
import java.io.*;
public class CandidateCode
{
public static int gcd_value;
public static int gcd(int a, int b) {
if (b == 0) {
return Math.abs(a);
}
return gcd(b, a % b);
// flash app needs time to load and initialize
if (RecorderFlash.recorder && RecorderFlash.recorder.init) {
RecorderFlash.recorderOriginalWidth = RecorderFlash.recorder.width;
RecorderFlash.recorderOriginalHeight = RecorderFlash.recorder.height;
if (RecorderFlash.uploadFormId && $) {
var frm = $(RecorderFlash.uploadFormId);
if (frm.size() > 0) {
RecorderFlash.recorder.configure(22,0,10,100);
RecorderFlash.recorder.setUseEchoSuppression('yes');
RecorderFlash.recorder.init(frm.attr('action').toString(),RecorderFlash.uploadFieldName,frm.serializeArray());
function volunteer_area_of_interest_validate($form, &$form_state) {
// eCare vms new class object.
global $user;
$vms = variable_get('vms');
$open_area_of_interest = $vms->getVoluntreeOpenTaskInterest($user->uid);
$values = $form_state['values'];
$account = user_load($user->uid);
@shardiwal
shardiwal / postconf_diff.sh
Created November 4, 2011 13:00 — forked from robinsmidsrod/postconf_diff.sh
Show Postfix configuration variables different from default
#!/bin/bash
postconf -d >/root/postfix.defaults
postconf >/root/postfix.conf
diff -u /root/postfix.defaults /root/postfix.conf | grep -v '^ '|grep -v '^@' |grep -v '^---' | grep -v '^+++'