Skip to content

Instantly share code, notes, and snippets.

@dkrvl
dkrvl / filterArray.js
Created March 2, 2023 06:20 — forked from jherax/arrayFilterFactory.1.ts
Filters an array of objects with multiple match-criteria.
/**
* Filters an array of objects using custom predicates.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria
* @return {Array}
*/
function filterArray(array, filters) {
const filterKeys = Object.keys(filters);
return array.filter(item => {
@dkrvl
dkrvl / sql.md
Created January 4, 2023 09:46 — forked from rosswd/sql.md
Learn Relational Database Design and SQL
@dkrvl
dkrvl / multi-git-win.md
Created January 4, 2023 09:44 — forked from rosswd/multi-git-win.md
Setting up a Github and Bitbucket account on the same computer on Mac OS. Now with a guide for Windows 10.

Setting up github and bitbucket on the same computer (Windows)

Guide for Windows

mix3d asked for some help using this guide with windows so here we go. This was tested with Windows 10. Run all commands in Git Bash once it's installed.

Github will be the main account and bitbucket the secondary.

Git for Windows

  • Download and install Git for Windows
    • In the installer, select everything but decide if you want a desktop icon (2nd step)
@dkrvl
dkrvl / dataURItoBlob.js
Created December 1, 2022 10:58 — forked from davoclavo/dataURItoBlob.js
Convert dataURI to Blob so large images do not crash the browser. Based on: http://stackoverflow.com/questions/10412299 and http://stackoverflow.com/questions/6850276
/*
The MIT License (MIT)
Copyright (c) 2016 David Gomez-Urquiza
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
/******************************************************
** Script: PDF save from GMAIL to Google Drive
** Script TYPE: Google Script
** Revision by: Dipak Raval
** Original Author: unknonw
******************************************************/
var GMAIL_LABEL = 'Salary_Slip'; /* Label name can be changed to yours */
var GDRIVE_FILE = 'MySalarySlips/$y/SalarySlip/$sublabel/$y-$m-$d_$domain_$mc_$ac.$ext'; /* File Path can be change to yours */
/*!
* jQuery Plugin
* Name: drtabs
*/
(function ($) {
$.fn.drtab = function ($element, options) {
// Establish our default settings
var settings = $.extend({
anchorClass: "tabLink",
activeClass: "active"
/*
* function name: fullpage
* Params:
* >> elem: element id or class stirng eg: ".someClass", ""#someID""
*/
function fullpage(elem, headerClass) {
$(elem).each(function (i, v) {
var that = this;
var winH = $(window).height();
var winW = $(window).width();
@dkrvl
dkrvl / readURL.js
Last active February 23, 2018 10:48
IT can read upload file data (image only) and visible client side
/*
* function name: read URL
* Params:
* >> input: input tag id or class, >> >> previewElclassName: class name where to show file name, >> imgFlag: true if uploading profile image OR Optional
*/
function readURL(input, previewElclassName, imgFlag) {
if (imgFlag == undefined) {
imgFlag = false;
}
if (input.files && input.files[0]) {
@dkrvl
dkrvl / carousalSYNC.js
Created February 23, 2018 10:43
Owl carousal syn: big with thumbnail
/***************************************************************************************
* OWL CAROUSAL START
***************************************************************************************/
/*
* function Name: carousalSYNC
* Params<types string>:
* fCarousel >> first carousel ID string or class string hear with dot(.) or (#)
* sCarousel >> second carousel ID string or class string hear with dot(.) or (#)
* limit >> number for thumbnail view
* Desc: This function find and check two Carousel and sync each other.
$.fn.customAlertFade = function () {
var that = this;
if (!that.html() == "") {
that.fadeIn("slow").delay(3000).addClass("in");
setTimeout(function () { that.fadeOut("slow").delay(5000).removeClass("in"); }, 5500);
setTimeout(function () { that.html(""); }, 6000);
}
};