Skip to content

Instantly share code, notes, and snippets.

View filter api call
getUserlist(filter: any, colSortBy: string, tableFilter: any): Observable < any > {
let params = new HttpParams();
for (var i = 0; i < tableFilter.length; i++) {
const obj = tableFilter[i];
const key = Object.keys(obj)[0];
params = params.append(key, obj[key]);
}
params = params.append('page-number', this.userData.pagination.pageNumber.toString());
params = params.append('page-size', this.userData.pagination.pageSize.toString());
@pssubashps
pssubashps / message.js
Created Jun 12, 2018
Web Push Receiver
View message.js
import { Injectable } from '@angular/core';
import { AngularFireDatabase } from 'angularfire2/database';
import { AngularFireAuth } from 'angularfire2/auth';
import * as firebase from 'firebase';
// import 'rxjs/add/operator/take';
import { BehaviorSubject } from 'rxjs'
@Injectable()
export class MessagingService {
View gist:77a87241086a1a0641de65054e9fa947
function copyToClipboard(text){
var dummy = document.createElement("input");
document.body.appendChild(dummy);
dummy.setAttribute('value', text);
dummy.select();
document.execCommand("copy");
document.body.removeChild(dummy);
}
copyToClipboard('Hello, World!')
@pssubashps
pssubashps / gist:883373ce0bb225d72251d7bdaa8aaf54
Created Apr 25, 2018
phone number country code add (UK)
View gist:883373ce0bb225d72251d7bdaa8aaf54
<?php
$number ="0232432434";
if(substr( $number, 0, 2 ) === "44") {
$number = '+'.$number;
}elseif(substr( $number, 0, 1 ) === "+") {
}elseif(substr( $number, 0, 1 ) === "0") {
$number = substr_replace($number, '+44', 0, 1);
}else{
$number = "+44". $number;
@pssubashps
pssubashps / ngsw-config.json
Created Jan 23, 2018
Sample Service worker config Angular5
View ngsw-config.json
{
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
View gist:bf50bfc9b2a21018d52427d0ad91df44
function postToUrl(message) {
var request = require('request');
var postParam = {};
postParam.state = message.state;
postParam.input = message.input;
postParam.outputKeyPrefix = message.outputKeyPrefix;
var options = {
method: 'post',
body: postParam, // Javascript object
json: true, // Use,If you are sending JSON data
@pssubashps
pssubashps / private-access-specifier.php
Created Jul 12, 2016
Private Access Specifier in PHP
View private-access-specifier.php
<?php
class Employees {
private $fistname;
private $lastname;
/**
* public variable
**/
public $organization ;
@pssubashps
pssubashps / public-access-specifier.php
Created Jul 12, 2016
Public Access Specifier in PHP example
View public-access-specifier.php
<?php
class Employees {
/**
* public variable
**/
public $organization ;
function __construct() {
$this->organization = 'Nidhi Infotech';
}
@pssubashps
pssubashps / php
Created Jul 12, 2016
Access public property
View php
<?php
class MyClass {
public $prop;
public $variable = "Hello";
function myfunc(){
$this->variable = 'value';
}
}
$obj = new MyClass;
View gist:4b858e5173a9dbc5557f06b018118abd
<?php
class MyClass {
public function __call($name, $args) {
switch ($name) {
case 'funcOne':
switch (count($args)) {
case 1:
return call_user_func_array(array($this, 'funcOneWithOneArg'), $args);
case 3: