Skip to content

Instantly share code, notes, and snippets.

View ktpm489's full-sized avatar
🎯
Focusing

ktpm489

🎯
Focusing
View GitHub Profile
@ktpm489
ktpm489 / codepush.md
Created January 14, 2020 10:18 — forked from quangdh/codepush.md
Tổng hợp các lệnh Code Push cơ bản

TỔNG HỢP CÁC LỆNH CODEPUSH CLI CƠ BẢN

Nhóm lệnh cơ bản

Login vào tài khoản AppCenter

code-push login

Logout tài khoản AppCenter

code-push logout

Xem đang login vào tài khoản AppCenter nào

code-push whoami

@ktpm489
ktpm489 / onesingal.service.ts
Created October 7, 2019 07:52 — forked from PsyGik/onesingal.service.ts
OneSignal Angular TypeScript
import {Injectable} from '@angular/core';
import {Cache} from '../utils/storage.provider'; // Decorator to access local storage
let OneSignal;
const url = '';
@Injectable()
export class OneSignalService {
@Cache({pool: 'OneSignal'}) oneSignalInit; // to check if OneSignal is already initialized.
@ktpm489
ktpm489 / download-file.js
Created September 17, 2019 07:38 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@ktpm489
ktpm489 / README.md
Created September 13, 2019 02:35 — forked from luciopaiva/_Full-socketio-client-and-server-example.md
Full socket.io client and server example

Full socket.io client and server example

To see a full explanation, read my answer on SO here: https://stackoverflow.com/a/24232050/778272.

How to use

Create a folder, run npm init -f on it and paste both server.js and client.js there (see files below). Needless to say, you must have Node.js installed on your system.

Install the required libraries:

@ktpm489
ktpm489 / initialize.sh
Created August 30, 2019 14:28 — forked from trongthanh/initialize.sh
Ubuntu Node Server Setup
#!/bin/bash
# NOTE: The commands here only applicable for Ubuntu 16.04 Xenial, do not use it for other distros
# Update server to latest packages
sudo apt update && sudo apt upgrade -y
# Install nginx and git
sudo apt install -y nginx git
@ktpm489
ktpm489 / feeds.model.js
Created August 5, 2019 08:00 — forked from dsternlicht/feeds.model.js
Feeds model with cache
// Feeds model after cache
import DB from '../db';
import CacheService from '../cache.service';
const ttl = 60 * 60 * 1; // cache for 1 Hour
const cache = new CacheService(ttl); // Create a new cache service instance
const FeedModel = {
@ktpm489
ktpm489 / feeds.model.js
Created August 5, 2019 08:00 — forked from dsternlicht/feeds.model.js
getFeedById with cache
// Feeds model after cache
import DB from '../db';
import CacheService from '../cache.service';
const ttl = 60 * 60 * 1; // cache for 1 Hour
const cache = new CacheService(ttl); // Create a new cache service instance
const FeedModel = {
// ...
@ktpm489
ktpm489 / feeds.model.js
Created August 5, 2019 08:00 — forked from dsternlicht/feeds.model.js
Initializing cache service in feeds model
// Initializing cache service in feeds model
import DB from '../db';
import CacheService from '../cache.service';
const ttl = 60 * 60 * 1; // cache for 1 Hour
const cache = new CacheService(ttl); // Create a new cache service instance
const FeedModel = {
...
@ktpm489
ktpm489 / cache.service.js
Created August 5, 2019 07:59 — forked from dsternlicht/cache.service.js
Cache service wrapper for node-cache module
import NodeCache from 'node-cache';
class Cache {
constructor(ttlSeconds) {
this.cache = new NodeCache({ stdTTL: ttlSeconds, checkperiod: ttlSeconds * 0.2, useClones: false });
}
get(key, storeFunction) {
const value = this.cache.get(key);
@ktpm489
ktpm489 / debug-signing.properties
Created July 22, 2019 23:00 — forked from niraj-shah/debug-signing.properties
Debug Build Signing for Cordova
# location of keystore
storeFile=/path/to/app.keystore
# Key alias
keyAlias=alias_name
# Store password
storePassword=Password1
# Key password