Skip to content

Instantly share code, notes, and snippets.

View tinganho's full-sized avatar

Tingan Ho tinganho

View GitHub Profile
@tinganho
tinganho / gist:34dd5afc0543326e1f4e
Created June 12, 2015 08:37
Generate Diagnostics file
function() {
var json = require('./errors/errors.json');
var errorText = 'export default {\n';
var length = Object.keys(json).length;
var index = 0;
for (var error in json) {
errorText += ' ' +
error.replace(/\s+/g, '_')
.replace(/['"\.]/g, '')
.replace(/{(\d)}/g, '$1');
export namespace Html {
let charToEntityRegex: RegExp;
let entityToCharRegex: RegExp;
let charToEntity: Map = {};
let entityToChar: Map = {
'&': '&',
'>': '>',
'&lt;': '<',
'&quot;': '"',
{
"locked": false,
"version": 1,
"targets": {
"DNX,Version=v4.5.1": {
"EntityFramework.Core/7.0.0-beta6-13752": {
"dependencies": {
"Ix-Async": "1.2.3",
"Microsoft.Framework.Caching.Abstractions": "1.0.0-beta6-11618",
"Microsoft.Framework.Caching.Memory": "1.0.0-beta6-11618",
@tinganho
tinganho / Feedback.md
Last active October 12, 2015 07:37
Kattis

Overall feedback

I think that the website is a little bit too barebone PHP. I usually work on a framework which defines frames for developers to work on. These frames usually creates a more strict and more structure for a project. More structure means less spaghetti code. It would be great also if the db queries could be handled in a backend service. More modern web framework doesn't even have a DB and should be stateless. I have also seen Javacript code written in the HTML templates, which is not the nicest solution, especially for JS developers like me.

Specifics

file_exists is an IO function and runs on every request. Since you cannot lazy cache it, because of how PHP works. I think you should at least define a map or an array with all the paths.

function delegate_request($controller, $action, $params) {
// Overwrite key bindings by placing them into your key bindings file.
[
{ "key": "shift+escape", "command": "closeReferenceSearchEditor",
"when": "inReferenceSearchEditor && !config.editor.stablePeek" },
{ "key": "escape", "command": "closeReferenceSearchEditor",
"when": "inReferenceSearchEditor && !config.editor.stablePeek" },
{ "key": "shift+escape", "command": "cancelSelection",
"when": "editorHasSelection && editorTextFocus" },
{ "key": "escape", "command": "cancelSelection",
"when": "editorHasSelection && editorTextFocus" },
class ImageService {
UserService(IBlobService _blobStorageService) { }
uploadImage(Image image) {
_blobStorageService.upload(image.toReadStream());
}
}
class TestBlobStorage : IBlobStorage {
async Task<void> upload(Image image) {
return;
}
}