Skip to content

Instantly share code, notes, and snippets.

View varavut's full-sized avatar

Varavut Lormongkol varavut

View GitHub Profile
(function f() {
async function sleep(mills) {
return new Promise((resolve, reject) => {
setTimeout(() => {
return resolve()
}, mills)
})
}
async function getPerformanceData() {
const maxTry = 10;
using System;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Net.Sockets;
namespace DnsCall
{
class Program
{
furyform.com, www.furyform.com {
tls varavut@vable.me
proxy / furyform.com:3000 {
transparent
}
}
2bedev.com, www.2bedev.com {
tls varavut@vable.me
proxy / 2bedev.com:2368 {
version: "2"
services:
caddy:
image: abiosoft/caddy:latest
container_name: caddy
ports:
- "80:80"
- "443:443"
....
furyform.com:
image: furyform:latest
build: ../furyform.com
container_name: furyform.com
environment:
- "NODE_ENV=production"
@varavut
varavut / caddy-part1-docker-compose.yml
Created May 13, 2017 08:37
caddy-part1-docker-compose.yml
version: "2"
services:
caddy:
image: abiosoft/caddy:latest
container_name: caddy
ports:
- "80:80"
- "443:443"
Meteor.methods({
'Threads.delete': function (threadId) {
if (!this.userId)
throw new Meteor.Error('Unauthorized', 'Please login before perform an action');
check(threadId, String);
Threads.remove({
_id: threadId,
owner: this.userId,
});
return { message: 'Threads.delete OK' };
Meteor.methods({
'Threads.create': function (title) {
if (!this.userId)
throw new Meteor.Error('Unauthorized', 'Please login before perform an action');
check(title, String);
Threads.insert({
title: title,
owner: this.userId,
createdAt: new Date(),
updatedAt: new Date()
if (Meteor.isServer) {
Threads.allow({
remove: function (userId, doc) {
if(!userId)
throw new Meteor.Error('Unauthorized', 'Please login before perform an action');
return result = doc.owner === userId;
}
});
}
if (Meteor.isServer) {
Threads.allow({
insert: function (userId, doc) {
if(!userId)
throw new Meteor.Error('Unauthorized', 'Please login before perform an action');
check(doc.title, String);
if (doc.owner && doc.owner != userId)
throw new Meteor.Error('No permission', 'Can\'t create a thread in the name of other');
doc.owner = userId;
doc.createdAt = new Date();