Skip to content

Instantly share code, notes, and snippets.

View shameemreza's full-sized avatar
🦜
Talk is cheap. Check My Code, Blog and Portfolio.

Shameem Reza shameemreza

🦜
Talk is cheap. Check My Code, Blog and Portfolio.
View GitHub Profile
// Remove query strings from static resources
function shameem_remove_cssjs_ver( $src ) {
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'shameem_remove_cssjs_ver', 10, 2 );
add_filter( 'script_loader_src', 'shameem_remove_cssjs_ver', 10, 2 );
// Remove WP version strings from scripts and styles
function shameem_remove_wp_version_strings( $src ) {
global $wp_version;
parse_str(parse_url($src, PHP_URL_QUERY), $query);
if ( !empty($query['ver']) && $query['ver'] === $wp_version ) {
$src = remove_query_arg('ver', $src);
}
return $src;
}
add_filter( 'script_loader_src', 'shameem_remove_wp_version_strings' );
#include<priority-queue>
using namespace std;
priority-queue<int> PQ; //decalre a max heap
PQ.push(4); //insert
PQ.top(); //maximum element
PQ.pop(); //pop max
PQ.size(); //returns size of heap
PQ.empty(); //returns 1 if heap is empty
//Assuming that there are 20 friends
int dp[1<<20][20];
//mask=frinds I already visited
//at=last visited friend
int Dp(int mask, int at)
{
//I used reference. It helps me not
//writing dp[mask] [at] again and again.
int& ret = dp[mask] [at];
//Assume that we initilized dp with -1
<script src="typed.js"></script>
<script>
$(function(){
$(".element").typed({
strings: ["First sentence.", "Second sentence."],
typeSpeed: 0
});
});
</script>
...
<p class="css-typing">This is a paragraph that is being typed by CSS animation.</p>
.css-typing
{
width: 30em;
white-space:nowrap;
overflow:hidden;
-webkit-animation: type 5s steps(50, end);
animation: type 5s steps(50, end);
}
@keyframes type{
benefit = (weight taken) x (total value of the item / total weight of the item)
weight taken = 5 x (1/2) = 5/2 (as we are taking 1/2 item)
#include <stdio.h>
struct Item {
char id[5];
int weight;
int value;
float density;
};
void fractionalKnapsack(Item items[], int n, int W);