Skip to content

Instantly share code, notes, and snippets.

View arunoda's full-sized avatar
👨‍🍳
Cooking something new

Arunoda Susiripala arunoda

👨‍🍳
Cooking something new
View GitHub Profile
var http = require('http');
var sys = require('sys');
function request()
{
var host = 'google.com';
var client = http.createClient(443, host, true);
var request = client.request('GET', '/',
{'host': host});
request.end();
Meteor.methods({
searchPosts: function(term) {
console.log('-- searching for "'+term+'" --')
Future = Npm.require('fibers/future');
var fut = new Future();
Meteor._RemoteCollectionDriver.mongo.db.executeDbCommand({
"text": "posts",
search: term
}, function (error,results){
<head>
<title>abc</title>
</head>
<body>
{{#sourceCode}}
<template name="books">
<input type="text" placeholder="Search..." value="{{booksSearchQuery}}">
{{#if searchResults.count}}

The prep-script.sh will setup the latest Node and install the latest perf version on your Linux box.

When you want to generate the flame graph, run the following (folder locations taken from install script):

sudo sysctl kernel/kptr_restrict=0

perf record -i -g -e cycles:u -- ~/sources/node/node --perf-basic-prof script.js

perf script | egrep -v "( __libc_start| LazyCompile | v8::internal::| Builtin:| Stub:| LoadIC:|\[unknown\]| LoadPolymorphicIC:)" | sed 's/ LazyCompile:[*~]\?/ /' | ~/sources/FlameGraph/stackcollapse-perf.pl > out.perf-folded
# add the email package
meteor add email
@arunoda
arunoda / notes.md
Created October 14, 2015 19:48 — forked from widged/notes.md
GraphQL links. Articles to read and code to check.
const express = require('express')
const next = require('next')
const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
const handle = app.getRequestHandler()
app.prepare()
.then(() => {
const server = express()