Skip to content

Instantly share code, notes, and snippets.

Avatar
😃
Writing Code and Having Fun :)

Abuzer Asif AbuzerAsif

😃
Writing Code and Having Fun :)
View GitHub Profile
@AbuzerAsif
AbuzerAsif / .jsbeautifyrc
Created Apr 20, 2018 — forked from wzup/.jsbeautifyrc
.jsbeautifyrc file example
View .jsbeautifyrc
{
// The plugin looks for a .jsbeautifyrc file in the same directory as the
// source file you're prettifying (or any directory above if it doesn't exist,
// or in your home folder if everything else fails) and uses those options
// along the default ones.
// Details: https://github.com/victorporof/Sublime-HTMLPrettify#using-your-own-jsbeautifyrc-options
// Documentation: https://github.com/einars/js-beautify/
"html": {
"allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg", "dust"],
@AbuzerAsif
AbuzerAsif / angularjs-interceptor.js
Last active May 8, 2018 — forked from edysegura/angularjs-interceptor.js
[angularjs] How to create an AngularJS HTTP Interceptor
View angularjs-interceptor.js
// Intercepting HTTP calls with AngularJS.
angular.module('MyApp', [])
.config(function ($provide, $httpProvider) {
// Add the interceptor to the $httpProvider.
$httpProvider.interceptors.push('MyHttpInterceptor');
})
// Intercept http calls.
.factory('MyHttpInterceptor', function ($q) {
return {
View gist:ad08ce03807256ead7b8b70c46c2df08
app.filter('bytes', function() {
return function(bytes, precision) {
if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-';
if (typeof precision === 'undefined') precision = 1;
var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'],
number = Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number];
}
});
View nodejs-xml-to-json-package-json-1.json
{
"name": "nodejs xml to json",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT"
@AbuzerAsif
AbuzerAsif / angular-custom-pipes-1.html
Last active Apr 3, 2019
Angular Custom Pipes and How it works
View angular-custom-pipes-1.html
<h1>{{ 'Hello world' | uppercase }}</h1> // Output: HELLO WORLD
@AbuzerAsif
AbuzerAsif / angular-custom-pipes-4.html
Last active Apr 3, 2019
Angular Custom Pipes and How it works
View angular-custom-pipes-4.html
<h1>{{ 500 | currency }}</h1> // Output: $500
@AbuzerAsif
AbuzerAsif / angular-custom-pipes-3.html
Last active Apr 3, 2019
Angular Custom Pipes and How it works
View angular-custom-pipes-3.html
<h1>{{ 'Hello world' | titlecase }}</h1> // Output: Hello World
@AbuzerAsif
AbuzerAsif / angular-custom-pipes-2.html
Last active Apr 3, 2019
Angular Custom Pipes and How it works
View angular-custom-pipes-2.html
<h1>{{ 'Hello world' | lowercase }}</h1> // Output: hello world
View angular-custom-pipes-10.ts
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'myCustomPipe'
})
export class MyCustomPipe implements PipeTransform {
transform(value:number, param1?:any, param2?:any):number {
return (value * param1) / param2; // returns 50
}
}
View angular-custom-pipes-9.html
<h1>{{ 100 | myCustomPipe: 5: 10 }}</h1> // Output: 50