Skip to content

Instantly share code, notes, and snippets.

View matteofigus's full-sized avatar
👋
I use Github at work

Matteo Figus matteofigus

👋
I use Github at work
View GitHub Profile
@matteofigus
matteofigus / oc.json
Created November 20, 2017 15:28
Mocks example
{
"registries": [
"https://your-registry.com/"
],
"mocks": {
"plugins": {
"static": {
"log": ""
},
"dynamic": {
@matteofigus
matteofigus / nbsp.js
Created March 31, 2017 11:11
Replace nbsp to regular whitespace in a folder of files
const _ = require('lodash')
const fs = require('fs')
const location = './en-us'
const files = fs.readdirSync(location)
_.each(files, (file) => {
const filePath = `${location}/${file}`
const content = fs.readFileSync(filePath, 'utf-8')
style
include something.css
p hello
@matteofigus
matteofigus / output1.html
Created October 11, 2015 15:22
grunt-api-benchmark output
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Api Benchmark :: report</title>
<!--[if lt IE 9]><script src="https://cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.8/excanvas.min.js"></script><![endif]-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.8/jquery.jqplot.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.8/plugins/jqplot.canvasTextRenderer.min.js"></script>
@matteofigus
matteofigus / mongo-ls.js
Created February 6, 2014 12:29
A script to list all the collections and document count for a specific mongodb db
// Usage: mongo {Server without mongodb:// example 127.0.0.1:27017}/{DbName} [-u {Username}] [-p {Password}] < ./mongo-ls.js
var collections = db.getCollectionNames();
print('Collections inside the db:');
for(var i = 0; i < collections.length; i++){
var name = collections[i];
if(name.substr(0, 6) != 'system')
print(name + ' - ' + db[name].count() + ' records');
@matteofigus
matteofigus / api-benchmark-example.js
Last active January 23, 2018 13:23
An example of request/response using api-benchmark with node.js https://github.com/matteofigus/api-benchmark
var apiBenchmark = require('api-benchmark');
var services = {
".NET": "http://localhost:57382/my-api/v1/",
"nodeJS": "http://localhost:3000/my-api/v1/"
};
var routes = {
"getUsers": "users/get",
"getUserInfo": "users/12345/get-info"