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);
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);
{
"objects": [{
"id": "557130d2b0174273057aa29e",
"user": "520b5cd36547c0393ad74769",
"book": "51e63f36252fecfb28005a4f",
"key": "fagbok_dictionary",
"value": "6",
"created": "2015-06-05T05:17:06.000Z",
"modified": "2015-06-05T05:17:06.933Z"
}, {
2015-02-02 17:09:57,896 [ 8727] [ERROR] [bom-feed-listener-random.pl] [App/Base/Daemon.pm:346] Shutting down: Connection error: 500 Internal Server Error at /home/git/regentmarkets/cpan/local/lib/perl5/CouchDB/Client/Doc.pm line 85.
CouchDB::Client::Doc::retrieve(CouchDB::Client::Doc=HASH(0x4900428)) called at /usr/share/perl5/BOM/Platform/Data/CouchDB/Connection.pm line 172
BOM::Platform::Data::CouchDB::Connection::try {...} () called at /home/git/regentmarkets/cpan/local/lib/perl5/Try/Tiny.pm line 81
eval {...} called at /home/git/regentmarkets/cpan/local/lib/perl5/Try/Tiny.pm line 72
Try::Tiny::try(CODE(0x8910e28), Try::Tiny::Catch=REF(0x8931cc0)) called at /usr/share/perl5/BOM/Platform/Data/CouchDB/Connection.pm line 180
BOM::Platform::Data::CouchDB::Connection::document(BOM::Platform::Data::CouchDB::Connection=HASH(0x88f3aa8), "RDYIN") called at /usr/share/perl5/BOM/Platform/Data/CouchDB.pm line 205
BOM::Platform::Data::CouchDB::document(BOM::Platform::Data::CouchDB=HASH(0x8915ee8), "RDYIN") cal