Skip to content

Instantly share code, notes, and snippets.

@gergelyke
gergelyke / en.js
Created May 15, 2018 20:44
1-1 English
const en = {
translations: {
meta: {
name: 'English'
},
header: {
title: '1-1 Question Ideas'
},
howto: {
title: 'How I use this app?',
@gergelyke
gergelyke / apple.js
Created January 19, 2018 21:57
Private ES6 methods
const transformName = Symbol('private:transformName');
class Apple {
constructor () {
console.log('i am created')
}
[transformName] (name) {
return name.split('').reverse().join('');
}
@gergelyke
gergelyke / keybase.md
Last active December 19, 2017 00:16
keybase.md

Keybase proof

I hereby claim:

  • I am gergelyke on github.
  • I am gergelyke (https://keybase.io/gergelyke) on keybase.
  • I have a public key ASBuTobbsUl8Z0Wjws_opsTzFRb2095pxd4x9y1n4gT7IQo

To claim this, I am signing this object:

@gergelyke
gergelyke / test.js
Created April 16, 2017 15:33
Array.pop() vs Array.length=0
var arraySize = 10000
var a = []
var sumTime = 0
function setup () {
for (var i = 0; i < arraySize; i+=1) {
a.push(i)
}
}
# Logs
logs
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
const heapdump = require('heapdump')
const app = require('koa')()
const router = require('koa-router')()
const log = [];
router.get('/', function *(next) {
log.push(this.headers)
this.body = {
status: 'finding a leak'
@gergelyke
gergelyke / app.js
Created January 24, 2015 19:29
Tessel with OpsGenie
function sendAlert (property, value) {
console.log('Sending alert... %s : %s', property, value);
var payload = {
apiKey: '',
message: ''
};
var options = {
host: 'api.opsgenie.com',
@gergelyke
gergelyke / User.js
Last active August 29, 2015 14:11
User model
function userModel (options) {
var db;
if (!options.db) {
throw new Error('Options.db is required');
}
db = options.db;
return {
@gergelyke
gergelyke / config.js
Last active March 14, 2020 01:38
Configuration with a config.js file
var url = require('url');
var config = module.exports = {};
var redisToGoConfig;
config.server = {
host: '0.0.0.0',
port: process.env.PORT || 3000
};
// look, a comment in the config file!
@gergelyke
gergelyke / index.js
Created December 14, 2014 14:30
NODE_PATH example
var Car = require('model/Car');