Two dependencies- Angular Material & Tailwind are used in this example that you can always remove and replace with your own.
@NgModule({| const urls: string[] = []; | |
| const gallery = [ | |
| {id: 1, url: 'http://example.com/1.png'}, | |
| {id: 2, url: 'http://example.com/2.png'} | |
| ]; | |
| // Long code | |
| gallery.forEach((item) => { | |
| urls.push(item.url); | |
| }); |
| import groovy.json.* | |
| Object getValue(String value) { | |
| try { | |
| JsonSlurper slurper = new JsonSlurper() | |
| return slurper.parseText(value) | |
| } catch (JsonException e) { | |
| // supress the exception - means it's unparceable | |
| } | |
Consider we have an external URL http://xyz.com which has some links (for example, http://example.com/privacy-policy) that needs to be opened in the new tab. The solution is very simple-
<a href="http://example.com/privacy-policy" target="_blank">
Privacy Policy| import {Injectable} from '@angular/core'; | |
| import {Subject, Subscription} from 'rxjs'; | |
| /** | |
| * A custom Events service just like Ionic 3 Events https://ionicframework.com/docs/v3/api/util/Events/ which got removed in Ionic 5. | |
| * | |
| * @author Shashank Agrawal | |
| */ | |
| @Injectable({ | |
| providedIn: 'root' |
| /** | |
| * Example component file | |
| */ | |
| import {Component, NgZone} from '@angular/core'; | |
| import {RazorpayWrapper} from '../utils/razorpay/wrapper'; | |
| @Component({ | |
| selector: 'app-home', | |
| templateUrl: 'home.page.html', |
| <div class="page-layout simple fullwidth"> | |
| <div class="header accent p-24" fxLayout="row" fxLayoutAlign="start center"> | |
| <h2>{{title}}</h2> | |
| </div> | |
| <div class="content p-24"> | |
| <h1 class="m-0">Quick stats and links</h1> | |
| <h4 class="secondary-text">coming soon..</h4> | |
| </div> |
| const url = new URLWrapper('https://example.com/?foo=bar&name=undefined&age=3'); | |
| console.log(url.getParam('foo') === 'bar'); | |
| console.log(url.getParam('name') === undefined); | |
| console.log(url.getParam('age') === '3'); |
| alias i='ionic' | |
| alias is='i serve' | |
| alias ib='i build' | |
| alias ic='i cordova' | |
| alias icb='ic build' | |
| alias icp='ic prepare' | |
| alias cr='cordova ' | |
| alias crun='cordova run ' | |
| alias crp='cordova platform' |
| alias guntrack='git update-index --assume-unchanged' | |
| alias gtrack='git update-index --no-assume-unchanged' | |
| alias gco='git checkout' | |
| alias gs='git status' | |
| alias gl='git log' | |
| ## Git log version 1 | |
| alias gl1="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --branches" | |
| ## Git log version 2 | |
| alias gl2='git log --graph --pretty=oneline --abbrev-commit' | |
| ## Git log version 3 |