Skip to content

Instantly share code, notes, and snippets.

View tinganho's full-sized avatar

Tingan Ho tinganho

View GitHub Profile
class TestBlobStorage : IBlobStorage {
async Task<void> upload(Image image) {
return;
}
}
class ImageService {
UserService(IBlobService _blobStorageService) { }
uploadImage(Image image) {
_blobStorageService.upload(image.toReadStream());
}
}
// 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" },
@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) {
{
"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",
export namespace Html {
let charToEntityRegex: RegExp;
let entityToCharRegex: RegExp;
let charToEntity: Map = {};
let entityToChar: Map = {
'&amp;': '&',
'&gt;': '>',
'&lt;': '<',
'&quot;': '"',
@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');
@tinganho
tinganho / gist:e343b8ae9e2c221f9241
Created October 6, 2014 16:24
currency symbols
module.exports = {
'AED': {
symbols: {
local: 'د.إ.‏',
global: 'Dhs',
reverseGlobal: 'Dhs'
},
text: {
ar: {
sudo npm install -g phonegap --verbose
Password:
npm info it worked if it ends with ok
npm verb cli [ 'node',
npm verb cli '/usr/local/bin/npm',
npm verb cli 'install',
npm verb cli '-g',
npm verb cli 'phonegap',
npm verb cli '--verbose' ]
npm info using npm@1.4.9
npm http GET https://registry.npmjs.org/phonegap
npm http 304 https://registry.npmjs.org/phonegap
npm http GET https://registry.npmjs.org/colors
npm http GET https://registry.npmjs.org/cordova
npm http GET https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/connect-phonegap
npm http GET https://registry.npmjs.org/phonegap-build
npm http GET https://registry.npmjs.org/pluralize
npm http GET https://registry.npmjs.org/prompt
npm http GET https://registry.npmjs.org/qrcode-terminal