Skip to content

Instantly share code, notes, and snippets.

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 June 12, 2018 12:52
Web Push Receiver
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 {
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 April 25, 2018 09:07
phone number country code add (UK)
<?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 January 23, 2018 12:00
Sample Service worker config Angular5
{
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
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 July 12, 2016 12:41
Private Access Specifier in PHP
<?php
class Employees {
private $fistname;
private $lastname;
/**
* public variable
**/
public $organization ;
@pssubashps
pssubashps / public-access-specifier.php
Created July 12, 2016 08:49
Public Access Specifier in PHP example
<?php
class Employees {
/**
* public variable
**/
public $organization ;
function __construct() {
$this->organization = 'Nidhi Infotech';
}
@pssubashps
pssubashps / php
Created July 12, 2016 07:05
Access public property
<?php
class MyClass {
public $prop;
public $variable = "Hello";
function myfunc(){
$this->variable = 'value';
}
}
$obj = new MyClass;
<?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: