Skip to content

Instantly share code, notes, and snippets.

@quyetvv
quyetvv / index.test.js
Created April 17, 2019 10:37
Example Puppeteer e2e tests from Ropig
import faker from 'faker'
import puppeteer from 'puppeteer'
const appUrlBase = 'http://localhost:4000'
const routes = {
public: {
register: `${appUrlBase}/register`,
login: `${appUrlBase}/login`,
noMatch: `${appUrlBase}/asdf`,
},
@quyetvv
quyetvv / html-languages.txt
Created February 27, 2018 04:16 — forked from JamieMason/html-languages.txt
HTML lang attribute / ISO language code reference / Culture names
CULTURE SPEC.CULTURE ENGLISH NAME
--------------------------------------------------------------
Invariant Language (Invariant Country)
af af-ZA Afrikaans
af-ZA af-ZA Afrikaans (South Africa)
ar ar-SA Arabic
ar-AE ar-AE Arabic (U.A.E.)
ar-BH ar-BH Arabic (Bahrain)
ar-DZ ar-DZ Arabic (Algeria)
ar-EG ar-EG Arabic (Egypt)
@quyetvv
quyetvv / testcpn.js
Created December 20, 2017 07:49
component with require
app.component('testcpn', {
templateUrl: 'template/page/advance-option.html',
controller: function ($http,$scope) {
var vm = this;
// put all code of controller inside of require and we can use all service defined by requireJs
require(['cmp-basic', 'cmp-form', 'cmp-headresult', 'service-service', 'service-gateway', 'pageManager', 'comparator', 'messagebox'], function (cmpBasic, cmpForm, cmpHeadresult, srvService, srvGateway, pageManager, comparator, messagebox) {
console.log(pageManager);
vm.date = new Date();
vm.applyClick = function (){
1. Build GraphQL server using `express-graphql` package.
2. Configure `schema.js` file.
3. Query for data.
public class RTMessage {
/// <summary>
/// This field used to set type of message transfered. It can be
/// 0: Stock list changes
/// 1: Sector changes
/// </summary>
public string MsType { get; set; }
/// <summary>
public class SignalRSender
{
IHubContext Context = GlobalHost.ConnectionManager.GetHubContext<MyHub>();
public void BroadcastMessage(RTMessage message)
{
Context.Clients.All.Invoke("receiveMessage", message.ToJson());
}
}
public class MyHub: Hub
{
public RTMessage RequestData(RTCRequest requestMessage)
{
try
{
return SignalRRequestHandler.Instance.HandleRequest(requestMessage, Context.ConnectionId);
}
catch (Exception ex)
{
public class AppStartup {
public void Configuration(IAppBuilder app){
app.UseCors(CorsOptions.AllowAll);
app.MapSignalR();
}
}
public class SignalRWebApp
{
public static void Start(string[] args)
{
string signalRServer = "http://localhost:8080";
// Make long polling connections wait a maximum of 110 seconds for a
// response. When that time expires, trigger a timeout command and
// make the client reconnect.
GlobalHost.Configuration.ConnectionTimeout = TimeSpan.FromSeconds(60));