Skip to content

Instantly share code, notes, and snippets.

@swapnilshrikhande
swapnilshrikhande / trim.java
Created February 21, 2024 07:57
Trim Non Space Characters In java
// Trim all whitespace characters
// It is a Unicode space character (SPACE_SEPARATOR, LINE_SEPARATOR, or PARAGRAPH_SEPARATOR) but is not also a non-breaking space ('\u00A0', '\u2007', '\u202F').
// Reference : https://docs.oracle.com/javase/8/docs/api/java/lang/Character.html#isWhitespace-char-
public static String trim(String value){
// first replace characters which are ignored by java to space.
char spaceChar = ' ';
return value == null ? null
: value.replace('\u00A0',spaceChar)
.replace('\u2007',spaceChar)
.replace('\u202F',spaceChar)
@swapnilshrikhande
swapnilshrikhande / function.php
Created April 26, 2016 10:08 — forked from YugalXD/function.php
Send mail with mailgun api by PHP CURL.
<?php
define('MAILGUN_URL', 'https://api.mailgun.net/v3/DOMAIN_NAME');
define('MAILGUN_KEY', 'KEY');
function sendmailbymailgun($to,$toname,$mailfromnane,$mailfrom,$subject,$html,$text,$tag,$replyto){
$array_data = array(
'from'=> $mailfromname .'<'.$mailfrom.'>',
'to'=>$toname.'<'.$to.'>',
'subject'=>$subject,
'html'=>$html,
@swapnilshrikhande
swapnilshrikhande / ElementData.java
Last active July 7, 2023 17:27
Parent base class for all webdriver test. Logic to create instance of webdriver and clean up webdriver.
package com.eternussolutions;
import org.openqa.selenium.By;
import java.util.HashMap;
public class ElementData {
public String value;
public By selector;
public HashMap<String,By> selectors;
public String triggerEvent;
@swapnilshrikhande
swapnilshrikhande / webtorrent_demo.js
Last active February 22, 2023 15:15
WebTorrent Configure Custom STUN / TURN Server
var client = window.client = new WebTorrent({
tracker: {
rtcConfig: rtcConfig
}
})
client.on('warning', onWarning)
client.on('error', onError)
torrent = client.add(TORRENT, onTorrent)
@swapnilshrikhande
swapnilshrikhande / README.md
Last active May 19, 2022 04:29
System Development Analysis Checklist

Per Requirement Analysis Checklist

  1. Possible way to approach the requirements to frame right set of questions ? - [ ] Which is the core domain problem system will be resolving or we will be automating ?
    • Business Domain - Eg. Automating Sales Process
    • Technical Domain - Eg. CTI Integration, Salesforce Sales Cloud Implementation
    • What is the need of the system ?
    • Who are the end users of the system ?
    • Who are the super/admin users of the system ?
@swapnilshrikhande
swapnilshrikhande / getStringBetween.js
Created May 6, 2022 11:05
JavaScript Get String Between Two Strings
function getStringBetween(str, start,end){
return str.substring(
str.indexOf(start) + start.length,
str.lastIndexOf(end)
);
}
@swapnilshrikhande
swapnilshrikhande / nested_sort.js
Created March 10, 2022 02:47
JavaScript Nested Sort On Multiple Fields
var providers = [
{
"provider" : {"name" : "Zaa"},
"licenseStates" : ["TX"]
},
{
"provider" : {"name" : "Aaa"},
"licenseStates" : ["CA"]
},
{
@swapnilshrikhande
swapnilshrikhande / ApexExtension.cls
Last active December 7, 2021 05:45
HttpConnector
public inherited sharing virtual class ApexExtension {
public static String str(String input){
return input == null ? '' : input;
}
public static String str(Object input){
return str(String.valueOf(input));
}
@swapnilshrikhande
swapnilshrikhande / UnDeleteContacts.cls
Created November 27, 2021 10:31
Undeleting Records In Apex (Salesforce)
List<Contact> contactsToUnDelete = new List<Contact>();
for(Contact c : [Select Id, Name, IsDeleted from Contact LIMIT 50000 ALL ROWS]){
if( c.IsDeleted == true ) {
System.debug('Undeleting Contact ='+c.Name+' : '+c.IsDeleted);
contactsToUnDelete.add(c);
}
}
if( contactsToUnDelete.size() > 0 ){
System.debug('Undeleting In Total '+contactsToUnDelete.size()+' Contacts');
undelete contactsToUnDelete;
@swapnilshrikhande
swapnilshrikhande / README.md
Created September 9, 2021 07:38
Merge Angular Project into Spring Boot project