Skip to content

Instantly share code, notes, and snippets.

View 2shrestha22's full-sized avatar
๐Ÿ’™
Dart / Flutter

Sangam Shrestha 2shrestha22

๐Ÿ’™
Dart / Flutter
View GitHub Profile
pre {
color: white;
border-left: 6px solid #bbb;
padding:5px 10px;
background: rgb(105,105,105);
font-size: 14px;
margin-right: 50px;
white-space:pre-wrap;
}
pre::selection { color: #696969; background: rgba(255, 255, 255, 0.996);
<img src="https://sangams.com.np/logo-footer.svg" height="60" alt="sangams.com.np"><br>[footer_copyright] ยท <a href="https://sangams.com.np/" title="Sangam's Blog" ><span>Sangam's Blog</span></a> ยท <strong>เฅ</strong> ยท Hosted by <a rel="nofollow" href="https://www.digitalberg.com/" title="DigitalBerg">DigitalBerg</a><br><a href="//sangams.com.np/about/">About</a> ยท <a href="https://sangams.com.np/contact/">Contact</a> ยท <a href="https://sangams.com.np/privacy-policy/">Privacy Policy</a> ยท <a href="https://sangams.com.np/sitemap_index.xml">Sitemap</a><!--
เฅ เคคเฅเคฐเฅเคฏเคฎเฅเคฌเค•เค‚ เคฏเคœเคพเคฎเคนเฅ‡ เคธเฅเค—เคจเฅเคงเคฟเค‚ เคชเฅเคทเฅเคŸเคฟเคตเคฐเฅเคงเคจเคฎเฅ เฅค เค‰เคฐเฅเคตเคพเคฐเฅเค•เคฎเคฟเคต เคฌเคจเฅเคงเคจเคพเคจเฅ เคฎเฅƒเคคเฅเคฏเฅ‹เคฐเฅเคฎเฅเค•เฅเคทเฅ€เคฏ เคฎเคพเคฎเฅƒเคคเคพเคคเฅ เฅฅ
เฅ เคคเฅเคฐเฅเคฏเคฎเฅเคฌเค•เค‚ เคฏเคœเคพเคฎเคนเฅ‡ เคธเฅเค—เคจเฅเคงเคฟเค‚ เคชเฅเคทเฅเคŸเคฟเคตเคฐเฅเคงเคจเคฎเฅ เฅค เค‰เคฐเฅเคตเคพเคฐเฅเค•เคฎเคฟเคต เคฌเคจเฅเคงเคจเคพเคจเฅ เคฎเฅƒเคคเฅเคฏเฅ‹เคฐเฅเคฎเฅเค•เฅเคทเฅ€เคฏ เคฎเคพเคฎเฅƒเคคเคพเคคเฅ เฅฅ
เฅ เคคเฅเคฐเฅเคฏเคฎเฅเคฌเค•เค‚ เคฏเคœเคพเคฎเคนเฅ‡ เคธเฅเค—เคจเฅเคงเคฟเค‚ เคชเฅเคทเฅเคŸเคฟเคตเคฐเฅเคงเคจเคฎเฅ เฅค เค‰เคฐเฅเคตเคพเคฐเฅเค•เคฎเคฟเคต เคฌเคจเฅเคงเคจเคพเคจเฅ เคฎเฅƒเคคเฅเคฏเฅ‹เคฐเฅเคฎเฅเค•เฅเคทเฅ€เคฏ เคฎเคพเคฎเฅƒเคคเคพเคคเฅ เฅฅ
-->
<section id="enews-ext-3" class="enews-widget">
<div class="enews">
<div class="widget-wrap">
<form id="subscribeenews-ext-3" name="submit" method="post" action-xhr="https://sangams.com.np/wpx/mailchimp-post.php" target="_top">
<p>Get awesome content delivered straight to your inbox. </p>
<input type="email" name="email" placeholder="Enter your email address" required="">
<input type="submit" value="Subscribe">
<div submitting>
<template type="amp-mustache">
Form submitting... Thank you for waiting.
@2shrestha22
2shrestha22 / cloudflare-worker-cors-fonts.js
Created September 14, 2019 12:36
Cloudflare workers script to enable CORS for fonts
// Sets Access-Control-Allow-Origin for fonts
// this worker should be used in subdomain from where fonts are being loaded but not in main site
// eg. www.example.com & static.example.com
// use this worker script with static.example.com
let corsHeaders = {
"Access-Control-Allow-Origin" : "https://sangams.com.np",
}
addEventListener('fetch', event => {
@2shrestha22
2shrestha22 / cloudflare-worker-edge-cache.js
Last active June 29, 2024 12:16
Cloudflare workers script to enable edge-cache. Use Official cloudflare wordpress pulgin for auto cache purge management
// Stop CF edge from caching your site when specific wordpress cookies are present
// script found in https://www.mmaton.com/2018/07/02/cloudflare-cache-anonymous-requests/
addEventListener('fetch', event => {
event.respondWith(noCacheOnCookie(event.request))
})
async function noCacheOnCookie(request) {
// Determine which group this request is in.
const cookie = request.headers.get('Cookie')
# Set page cache expiration time to 10 minutes
Header set Cache-Control "max-age=600, must-revalidate" "expr=%{REQUEST_URI} !~ m#^/wp-admin#"
//adds social share in AMP pages add in function.php /WP
add_filter('the_content', 'my_social_share');
function my_social_share($content) {
if(is_single()) {
$before_after_content = '<div class=social-share>
<amp-social-share width=35 height=35 type=facebook data-param-app_id=xxxxxxxxxxxxx></amp-social-share>
<amp-social-share height=35 width=35 type=twitter></amp-social-share>
<amp-social-share height=35 width=35 type="system"></amp-social-share>
</div>';
//adding adsense ad unit inside the article
//Insert ads after second paragraph of single post content.
add_filter( 'the_content', 'prefix_insert_post_ads' );
function prefix_insert_post_ads( $content ) {
$ad_code1 = '<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- inContent -->
<?php
//adding adsense ad unit inside the article
//Insert ads after second paragraph of single post content.
add_filter( 'the_content', 'prefix_insert_post_ads' );
function prefix_insert_post_ads( $content ) {
$ad_code1 = '<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<?php
//--------------------------------------------------------------
//--------------------------------------------------------------
//---------COPY CODE BELOW THIS LINE----------------------------
//Adding adsense ad unit inside the article
//Insert ads after every third paragraph of single post content.