This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gcprofiler = require('gc-profiler'); | |
var fs = require('fs'); | |
var _datadir = null; | |
module.exports.init = function (datadir) { | |
var stamp = Date.now(); | |
var time = process.hrtime(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Simple userland heapdump generator using v8-profiler | |
* Usage: require('[path_to]/HeapDump').init('datadir') | |
* | |
* @module HeapDump | |
* @type {exports} | |
*/ | |
var fs = require('fs'); | |
var profiler = require('v8-profiler'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Simple userland CPU profiler using v8-profiler | |
* Usage: require('[path_to]/CpuProfiler').init('datadir') | |
* | |
* @module CpuProfiler | |
* @type {exports} | |
*/ | |
var fs = require('fs'); | |
var profiler = require('v8-profiler'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char * buffer; | |
buffer = (char*) malloc (42); | |
// Do something with buffer | |
free (buffer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import DiscoverReleaseForm from "./releaseManager/DiscoverReleaseForm"; | |
import EditReleaseForm from "./releaseManager/EditReleaseForm"; | |
class ReleaseManager extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var numbers = [12, 22, 45, 13, 66, 1, 100, 1, 210, 10, 11]; | |
var max = 0; | |
for (var i = 0;i < numbers.length; i++){ | |
console.log(`numbers.length is ${numbers.length}, i is ${i}, numbers at position ${i} is ${numbers[i]}`); | |
console.log(`Now we test if ${max} is lower than ${numbers[i]}`); | |
if(max < numbers[i]){ | |
console.log(`I is lower, so now ${numbers[i]} is the new max.`); | |
max = numbers[i]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const router = express.Router(); | |
const isGithubUrl = require('is-github-url'); | |
const ProjectModel = require('../models/Project'); | |
// I am using async because I need await later | |
router.post('/', async (req, res, next) => { | |
const url = req.body.githubUrl.trim(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ProjectModel = require('../models/Project'); | |
const isGithubUrl = require('is-github-url'); | |
class ProjectService { | |
static create(url) { | |
const url = url.trim; | |
if (!isGithubUrl(url)) { | |
throw new Error('This is not a valid GitHub URL!'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mongoose = require('mongoose'); | |
const isGithubUrl = require('is-github-url'); | |
const ProjectSchema = mongoose.Schema({ | |
githubUrl: { | |
type: String, | |
required: true, | |
unique: true, | |
index: true, | |
trim: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const ProjectService = require('../services/ProjectService'); | |
const router = express.Router(); | |
module.exports = (params) => { | |
// Note that we are using async here, because we will await later | |
router.get('/', async (req, res) => { | |
try { | |
const createResult = await ProjectService.create(req.body.githubUrl); |