This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="typed.js"></script> | |
<script> | |
$(function(){ | |
$(".element").typed({ | |
strings: ["First sentence.", "Second sentence."], | |
typeSpeed: 0 | |
}); | |
}); | |
</script> | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p class="css-typing">This is a paragraph that is being typed by CSS animation.</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.css-typing | |
{ | |
width: 30em; | |
white-space:nowrap; | |
overflow:hidden; | |
-webkit-animation: type 5s steps(50, end); | |
animation: type 5s steps(50, end); | |
} | |
@keyframes type{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
benefit = (weight taken) x (total value of the item / total weight of the item) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
weight taken = 5 x (1/2) = 5/2 (as we are taking 1/2 item) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
struct Item { | |
char id[5]; | |
int weight; | |
int value; | |
float density; | |
}; | |
void fractionalKnapsack(Item items[], int n, int W); |