Skip to content

Instantly share code, notes, and snippets.

@quangquy87
quangquy87 / free-database-hosting.md
Created January 23, 2024 04:34 — forked from bmaupin/free-database-hosting.md
Free database hosting
@quangquy87
quangquy87 / CoroutineIntentService.kt
Created November 18, 2021 04:49 — forked from RohitSurwase/CoroutineIntentService.kt
IntentService (Service) using Kotlin Coroutines instead of Handler+Looper.
import android.app.Service
import android.content.Intent
import android.os.IBinder
import android.support.annotation.Nullable
import android.support.annotation.WorkerThread
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.SendChannel
import kotlinx.coroutines.channels.actor
import kotlin.coroutines.CoroutineContext
@quangquy87
quangquy87 / gist:866317930b9f5187951c2705248a0163
Created May 22, 2020 16:09 — forked from zelid/gist:6965002
Examples of BulkInsert for PostgreSQL, MySQL and MS SQL using ServiceStack OrmLite. Work in progress...
public static void BulkInsertNpgsql<T>(this IDbConnection dbConn, IEnumerable<T> list, IEnumerable<string> insertFields = null)
{
if (list == null) return;
if (list.Count() < 1) return;
var objWithAttributes = list.FirstOrDefault();
var modelDef = OrmLiteConfig.GetModelDefinition(objWithAttributes.GetType());
if (insertFields == null) insertFields = new List<string>();
@quangquy87
quangquy87 / index.js
Created April 10, 2020 02:40 — forked from naumanahmed19/index.js
Firebase Firestore Cloud Messaging(Notification) Server Function
const functions = require("firebase-functions");
var request = require("request");
var API_KEY = "YOUR-API-KEY"; // Your Firebase Cloud Messaging Server API key
function sendNotificationToUser(userId, message) {
request(
{
url: "https://fcm.googleapis.com/fcm/send",
method: "POST",
@quangquy87
quangquy87 / data.cs
Last active December 18, 2018 02:21 — forked from gistlyn/data.cs
PKPL
using System.Collections.Generic;
using System.Data;
using ServiceStack;
using ServiceStack.OrmLite;
using ServiceStack.DataAnnotations;
using System;
[Alias("WarehouseTransferDetails")]
public class WarehouseTransferDetail
{
@quangquy87
quangquy87 / data.cs
Created December 9, 2018 14:15 — forked from gistlyn/main.cs
PKPL TEST
// data.cs
// Created by quangquy87 on 2018/12/09
@quangquy87
quangquy87 / gist:ecb94d4437f9c6ab7dbfc07cc88afbae
Created November 9, 2017 06:13 — forked from minardimedia/gist:3610889
String Functions for Javascript – trim, to camel case, to dashed, and to underscore
Trim String
String.prototype.trim = function(){
return this.replace(/^\s+|\s+$/g, "");
};
To Camel Case
String.prototype.toCamel = function(){
return this.replace(/(\-[a-z])/g, function($1){return $1.toUpperCase().replace('-','');});
@quangquy87
quangquy87 / main.js
Created July 2, 2016 04:47 — forked from turtlemonvh/main.js
Angular Messaging
var MyApp = angular.module('MyApp');
MyApp.factory('msgBus', ['$rootScope', function($rootScope) {
var msgBus = {};
msgBus.emitMsg = function(msg, data) {
data = data || {};
$rootScope.$emit(msg, data);
};
msgBus.onMsg = function(msg, func, scope) {
var unbind = $rootScope.$on(msg, func);
if (scope) {