Skip to content

Instantly share code, notes, and snippets.


Sangam Kumar Shrestha 2shrestha22

View GitHub Profile
2shrestha22 / .md
Created May 14, 2021 — forked from joepie91/.md
Running a Node.js application using nvm as a systemd service
View .md

Read this first!

Hi there! Since this post was originally written, nvm has gained some new tools, and some people have suggested alternative (and potentially better) approaches for modern systems. Make sure to have a look at the comments to this article, before following this guide!

The original article

Trickier than it seems.

View repeatingAdInsideListview.dart
//where _kAdIndex is an int and after each -kAdIndex in the listView Ad is displayed
controller: _scrollController,
cacheExtent: 20,
itemCount: data.layoutList.length +
(data.layoutList.length ~/ _kAdIndex),
itemBuilder: (BuildContext context, int index) {
if (index != 0 && (index + 1) % (_kAdIndex + 1) == 0) {
View regular_expressions.dart
class RegX {
static final RegExp _emailRegExp = RegExp(
static final RegExp _nonDigitsExp = RegExp(r'[^\d]');
static final RegExp _anyLetter = RegExp(r'[A-Za-z]');
static final RegExp _phoneRegExp = RegExp(r'^\d{7,15}$');
static final RegExp _ipv4RegExp = RegExp(
static final RegExp _ipv6RegExp = RegExp(
View freezed_snippet.code-snippets
// by ResoCoder
"Part statement": {
"prefix": "pts",
"body": [
"part '${TM_FILENAME_BASE}.g.dart';",
"description": "Creates a filled-in part statement"
View generatepress-sangams-blog-additional-css.css
#right-sidebar {
position: -webkit-sticky;
position: sticky;
top: 0;
.site-header, .inside-article,.sidebar .widget, .comments-area, .paging-navigation, .my-ad, .wp-block-image {
-webkit-box-shadow: 5px 5px 30px -10px rgba(46,46,46,0.5);
-moz-box-shadow: 5px 5px 30px -10px rgba(46,46,46,0.5);
View ads-after-each-3rd-paragraph.php
//---------COPY CODE BELOW THIS LINE----------------------------
//Adding adsense ad unit inside the article
//Insert ads after every third paragraph of single post content.
View ads-inside-content-1.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=""></script>
View ads-inside-content-2.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=""></script>
<!-- inContent -->
View amp-social-share.php
//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>
View max-age_must-revalidate.htaccess
# Set page cache expiration time to 10 minutes
Header set Cache-Control "max-age=600, must-revalidate" "expr=%{REQUEST_URI} !~ m#^/wp-admin#"