Skip to content

Instantly share code, notes, and snippets.

View Jacknq's full-sized avatar
💭
keep goin

Jack Jacknq

💭
keep goin
View GitHub Profile
@DustinCampbell
DustinCampbell / using-msbuildworkspace.md
Created April 10, 2018 21:36
Using MSBuildWorkspace

Introduction

Roslyn provides a rich set of APIs for analyzing C# and Visual Basic source code, but constructing a context in which to perform analysis can be challenging. For simple tasks, creating a Compilation populated with SyntaxTrees, MetadataReferences and a handful of options may suffice. However, if there are multiple projects involved in the analysis, it is more complicated because multiple Compilations need to be created with references between them.

To simplify the construction process. Roslyn provides the Workspace API, which can be used to model solutions, projects and documents. The Workspace API performs all of the heavy lifting needed to parse SyntaxTrees from source code, load MetadataReferences, and construct Compilations and add references between them.

@silkentrance
silkentrance / README.md
Last active August 7, 2019 22:19
Vuetify with TypeScript

Vuetify with TypeScript

The following changes to the standard setup of the vuetify template will allow you to use typescript instead of babel or just plain javascript.

WORK IN PROGRESS

Additional changes have to be made to vuetify in order to get this running, namely the vuetify typescript declarations. I am currently working on that. Patience is a virtue.

@ramonfritsch
ramonfritsch / expressjs-rewrite.js
Created November 9, 2016 17:06
URL rewrite on ExpressJS 4.0
....
//This is how you'd do on ExpressJS 3.0
app.get('/my/route1/', function (req, res, next) {
req.url = '/other/route2/';
next('route');
});
app.get('/other/route2/', function (req, res, next) {
res.send('I am other route 2');
@wojteklu
wojteklu / clean_code.md
Last active April 25, 2024 19:12
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@clarkenheim
clarkenheim / mongodb_distinct_count.js
Last active December 12, 2023 09:22
MongoDB equivalent of an SQL query to get the distinct values of a field in a collection including the count of documents which have each distinct value (distinct with count)
//equivalent of MySQL SELECT COUNT(*) AS cnt, fieldName FROM someTable GROUP BY fieldName;
db.someCollection.aggregate([{"$group" : {_id:"$fieldName", cnt:{$sum:1}}}]);
//as above but ordered by the count descending
//eg: SELECT COUNT(*) AS cnt, fieldName FROM someTable GROUP BY fieldName ORDER BY cnt DESC;
db.someCollection.aggregate([{"$group" : {_id:"$fieldName", cnt:{$sum:1}}}, {$sort:{'cnt':-1}}]);
@denji
denji / nginx-tuning.md
Last active April 24, 2024 19:39
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.