Skip to content

Instantly share code, notes, and snippets.

View rajvanshipradeep15's full-sized avatar

Pradeep Rajvanshi rajvanshipradeep15

  • India
View GitHub Profile
var letterCombinations = function (digits) {
let alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');
let digitValues = [];
let calculationArr = [];
let resultSet = [];
for (let i = 2; i < 10; i++) {
if (i === 7 || i === 9) {
digitValues[i] = alphabet.splice(0, 4)
} else {
digitValues[i] = alphabet.splice(0, 3)
@rajvanshipradeep15
rajvanshipradeep15 / send-whatsapp.gs
Created July 16, 2023 11:05 — forked from whatsmate/send-whatsapp.gs
Sending a WhatsApp message from Google Apps Script
function main() {
var destNumber = "12025550108"; // TODO: Specify the recipient's number here. NOT THE GATEWAY NUMBER!
var message = "Aloha, this is my first message.";
sendWhatsapp(destNumber, message);
}
function sendWhatsapp(destNumber, message) {
var instanceId = "YOUR_INSTANCE_ID_HERE"; // TODO: Replace it with your gateway instance ID here
var clientId = "YOUR_CLIENT_ID_HERE"; // TODO: Replace it with your Forever Green client ID here
Contributing my 2 cents
$indianStates = ['AR' => 'Arunachal Pradesh',
'AR' => 'Arunachal Pradesh',
'AS' => 'Assam',
'BR' => 'Bihar',
'CT' => 'Chhattisgarh',
'GA' => 'Goa',
'GJ' => 'Gujarat',
'HR' => 'Haryana',
@rajvanshipradeep15
rajvanshipradeep15 / svn_resolve.md
Created November 24, 2021 13:07 — forked from Nathaniel100/svn_resolve.md
svn: how to resolve “local edit, incoming delete upon update” message

svn: how to resolve “local edit, incoming delete upon update” message

$ svn st
!  +  C foo
      >   local edit, incoming delete upon update
!  +  C bar
      >   local edit, incoming delete upon update
$ touch foo bar
$ svn revert foo bar
$ rm foo bar
<?php
$arrContextOptions=array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
);
$response = file_get_contents("https://maps.co.weber.ut.us/arcgis/rest/services/SDE_composite_locator/GeocodeServer/findAddressCandidates?Street=&SingleLine=3042+N+1050+W&outFields=*&outSR=102100&searchExtent=&f=json", false, stream_context_create($arrContextOptions));
//https://www.codexworld.com/capture-screenshot-website-url-php-google-api/
//website url
$siteURL = "http://www.codexworld.com/";
//call Google PageSpeed Insights API
$googlePagespeedData = file_get_contents("https://www.googleapis.com/pagespeedonline/v2/runPagespeed?url=$siteURL&screenshot=true");
//decode json data
$googlePagespeedData = json_decode($googlePagespeedData, true);
@rajvanshipradeep15
rajvanshipradeep15 / gist:ac929cd5430276d4bb034711b7348e82
Created March 12, 2019 09:24
Only Alphabets in input field allowed
$('.signature_field').bind('keyup blur',function(){
var node = $(this);
node.val( node.val().replace(/[^a-z]/g,'') );
});
@rajvanshipradeep15
rajvanshipradeep15 / how you get JSON data on error
Created November 21, 2018 05:17
how you get JSON data on error
Here's an example of how you get JSON data on error:
$.ajax({
url: '/path/to/script.php',
data: {'my':'data'},
type: 'POST'
}).fail(function($xhr) {
var data = $xhr.responseJSON;
console.log(data);
});
@rajvanshipradeep15
rajvanshipradeep15 / Get text value from string containing anchor tag
Last active November 19, 2018 17:53
Get text value from string containing anchor tag
var myrRegexp = /<a[^>]*>(.*?)<\/a>/i,
subjectString = '<a blah blah>Click Here</a>',
match = myrRegexp.exec(subjectString);
if (match != null && match.length > 1) {
return match[1];
} else {
return = "";
}
// PHP
<?php
// your code goes here
class Example {
private $search;
public function __construct ($search) {
$this->search = $search;
}