Skip to content

Instantly share code, notes, and snippets.

View prosenjit-manna's full-sized avatar
🎯
Focusing

Prosenjit Manna prosenjit-manna

🎯
Focusing
  • Itobuz Technologies
View GitHub Profile

Reading data before application startup in Angular 2

In this demonstration I will show you how to read data in Angular2 final release before application startup. You can use it to read configuration files like you do in other languages like Java, Python, Ruby, Php.

This is how the demonstration will load data:

a) It will read an env file named 'env.json'. This file indicates what is the current working environment. Options are: 'production' and 'development';

b) It will read a config JSON file based on what is found in env file. If env is "production", the file is 'config.production.json'. If env is "development", the file is 'config.development.json'.

@prosenjit-manna
prosenjit-manna / gist:6e380c9aab7f9d17df72f5a637215fb5
Created May 11, 2017 13:14 — forked from wpexplorer/gist:cce8a00830af9d649afd4a0a7e219937
Advanced wp_oembed_get output for videos to add classes & params
// Function
function wpex_video_oembed( $video = '', $classes = '', $params = array() ) {
// Define output
$output = '';
// Sanitize URl
$video = esc_url( $video );
// Video required
@prosenjit-manna
prosenjit-manna / AWS-config.md
Created December 29, 2016 05:13
Fucking Yes! AWS setup for Wordpress Server

Fucking Yes! AWS setup for Awesome Fast Wordpress Server

Ramblings and notes of my experiments with AWS which I will later turn into more coherent instructions.

Sooo... I'm about to be released into the wild as a free roaming web developer. I won't have the company hosting anymore and it's damn well about time I got my own shit sorted. After a little reading I have decided to give Amazon Web Services a try. So far I am loving it.

I have oooooooodles of control. It's super nerdy and more importantly, it's super fast. Seriously - I had fun.

When I first set this up i tried following some third party tutorials to get a wordpress server setup and running on Amazon Web Services. After some trial and error I found the proper documentation and everything when much more smoothly (I know right)! The AWS docs are very detailed and easy to follow.

@prosenjit-manna
prosenjit-manna / ALTERNATIVES.adoc
Created November 1, 2016 08:00 — forked from mbbx6spp/ALTERNATIVES.adoc
Super quick list of alternatives to Jira and/or Confluence, Stash, Crucible, etc.
@prosenjit-manna
prosenjit-manna / README.md
Created August 25, 2016 06:15 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@prosenjit-manna
prosenjit-manna / .htaccess
Created August 19, 2016 05:31 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@prosenjit-manna
prosenjit-manna / GitHub-Forking.md
Created August 13, 2016 05:18 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, when I started going through the process of forking and issuing pull requests, I had some trouble figuring out the proper method for doing so and made quite a few mistakes along the way. I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your

@prosenjit-manna
prosenjit-manna / vt_resize.php
Created August 4, 2016 08:00 — forked from seedprod/vt_resize.php
Resize WordPress images on the fly vt_resize w/ multisite support
<?php
/*
* Resize images dynamically using wp built in functions
* Victor Teixeira
*
* php 5.2+
*
* Exemplo de uso:
*
* <?php
@prosenjit-manna
prosenjit-manna / gist:4dcaabcfe108989fe11c83d76437bbfe
Created July 27, 2016 06:05 — forked from mikejolley/gist:2044109
WooCommerce - Update number of items in cart and total after Ajax
<?php
// Ensure cart contents update when products are added to the cart via AJAX (place the following in functions.php)
add_filter( 'woocommerce_add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment' );
function woocommerce_header_add_to_cart_fragment( $fragments ) {
ob_start();
?>
<a class="cart-contents" href="<?php echo WC()->cart->get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf (_n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>
<?php
@prosenjit-manna
prosenjit-manna / currency_list
Created June 23, 2016 11:17 — forked from MindaugasR/currency_list
World Currency list in PHP Array
array (
'ALL' => 'Albania Lek',
'AFN' => 'Afghanistan Afghani',
'ARS' => 'Argentina Peso',
'AWG' => 'Aruba Guilder',
'AUD' => 'Australia Dollar',
'AZN' => 'Azerbaijan New Manat',
'BSD' => 'Bahamas Dollar',
'BBD' => 'Barbados Dollar',
'BDT' => 'Bangladeshi taka',