Skip to content

Instantly share code, notes, and snippets.

@BhargavBhandari90
BhargavBhandari90 / functions.php
Last active August 1, 2023 22:41
Custom code for getting profile pic, cover pic etc from Amazon s3 bucket
<?php
/**
* Set selected url structure, selected in rtAmazon settings.
*
* @since 1.4.0
*
* @param string $urls urls in content.
*
* @return array $newurls/$urls return array of all urls in content.
*/
@jherax
jherax / arrayFilterFactory.1.ts
Last active February 20, 2025 05:05
Filters an array of objects with multiple match-criteria.
type FilterOperator = 'AND' | 'OR';
type FiltersBy<T> = {
[K in keyof T]?: (value: T[K]) => boolean;
};
/**
* Factory function that creates a specialized function to filter
* arrays, by validating all filters (AND operator),
* or validating just one of the filters (OR operator).
* @param operator Method to validate all filters: AND, OR
@tschf
tschf / google_drive.pkb
Last active November 30, 2021 00:36
google_drive in plsql
create or replace
PACKAGE GOOGLE_DRIVE
as
type t_varchar2 is table of varchar2(50);
-- Set default folder ID to upload to (got from last portion of URL when opening folder)
g_upload_folder_id varchar2(400) := '';
procedure get_authorization_url(
@troufster
troufster / formsdec.js
Created April 27, 2012 18:52
Decrypt .NET forms auth cookie in node.js
function hex2a(hex) {
var str = '';
for (var i = 0; i < hex.length; i += 2)
str += String.fromCharCode(parseInt(hex.substr(i, 2), 16));
return str;
}
//Raw cookie
var cookie = "B417B464CA63FE780584563D2DA4709B03F6195189044C26A29770F3203881DD90B1428139088D945CF6807CA408F201DABBADD59CE1D740F853A894692273F1CA83EC3F26493744E3D25D720374E03393F71E21BE2D96B6110CB7AC12E44447FFBD810D3D57FBACA8DF5249EB503C3DFD255692409F084650EFED205388DD8C08BF7B941E1AC1B3B70B9A8E09118D756BEAFF25834E72357FD40E80E76458091224FAE8";