Skip to content

Instantly share code, notes, and snippets.

View 2shrestha22's full-sized avatar
🌀
Fluttering

Sangam Kumar Shrestha 2shrestha22

🌀
Fluttering
View GitHub Profile
@2shrestha22
2shrestha22 / _common.conf
Created June 29, 2021 01:01 — forked from Daniel15/_common.conf
WordPress config with WP Super Cache for Nginx
# /etc/nginx/snippets/wordpress/common.conf
index index.php;
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /\. {
deny all;
}
# Block PHP files in uploads, content, and includes directory.
location ~* /(?:uploads|files|wp-content|wp-includes)/.*\.php$ {
@2shrestha22
2shrestha22 / .md
Created May 14, 2021 16:10 — forked from joepie91/.md
Running a Node.js application using nvm as a systemd service

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.

@2shrestha22
2shrestha22 / sublime3-build3143.txt
Created September 26, 2017 12:56
Sublime Text 3 Build 3143 License Key
—– BEGIN LICENSE —–
TwitterInc
200 User License
EA7E-890007
1D77F72E 390CDD93 4DCBA022 FAF60790
61AA12C0 A37081C5 D0316412 4584D136
94D7F7D4 95BC8C1C 527DA828 560BB037
D1EDDD8C AE7B379F 50C9D69D B35179EF
2FE898C4 8E4277A8 555CE714 E1FB0E43
D5D52613 C3D12E98 BC49967F 7652EED2
//where _kAdIndex is an int and after each -kAdIndex in the listView Ad is displayed
ListView.builder(
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) {
print(index);
class RegX {
static final RegExp _emailRegExp = RegExp(
r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9\-\_]+(\.[a-zA-Z]+)*$");
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(
r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$');
static final RegExp _ipv6RegExp = RegExp(
r'^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[
// by ResoCoder
// https://github.com/rrousselGit/freezed/issues/85#issuecomment-593908291
{
"Part statement": {
"prefix": "pts",
"body": [
"part '${TM_FILENAME_BASE}.g.dart';",
],
"description": "Creates a filled-in part statement"
},
#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);
@2shrestha22
2shrestha22 / spfooter.php
Last active April 6, 2020 18:00
Removes Spacious Footer Credits With Your Own
<?php
//copy below this line, you shouldn't include <?php
//paste this code in your function.php
//spacious footer
if (! function_exists('spacious_custom_credits')) {
add_action('init','remove_default_credits');
function remove_default_credits(){
remove_action('spacious_footer_copyright','spacious_footer_copyright');
<?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>
//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 -->