Skip to content

Instantly share code, notes, and snippets.

var n3xt = require("n3xt");
var fs = require('fs');
var wstream = fs.createWriteStream('test.txt');
var users = {
data: {},
getUserById: function (id) {
return this.data[id];
},
remoteUserById: function (id) {
@erayarslan
erayarslan / dbrain.js
Created August 2, 2016 12:44
brain davai
var test = function () {
this.a = 3;
this.b = 3;
this._unmap = "hi";
var c = 3;
this.d = (function () {
console.log(this.toJSON());
}).bind(this);
@erayarslan
erayarslan / issiz.js
Created August 1, 2016 11:32
işsizlik.avi
var out = String(/"String".split(eval(String(String).split(" ")[1])).pop()/);
console.log(out); // so?
@erayarslan
erayarslan / observer_pattern.js
Created May 9, 2016 14:07
observer pattern for js
var Observable = function () {
this.observers = [];
};
Observable.prototype.register = function ($) {
if (this.observers.indexOf($) == -1) {
this.observers.push($);
}
};
@erayarslan
erayarslan / calc.js
Created February 29, 2016 11:56
calc module for podbot
var Calc = function () {
};
Calc.prototype.add = function (a, b) {
return a + b;
};
module.exports = Calc;
@erayarslan
erayarslan / next.js
Created February 24, 2016 15:34
javascript function iteration
(function () {
var Next = function (arr) {
var next = function (i) {
return i != arr.length ? function () {
arr[i](next(i + 1));
} : function () {
}
};
next(0)();
};
@erayarslan
erayarslan / $ws.js
Last active February 12, 2016 15:11
spachcock ws example
var WebSocket = require('ws');
var Spachcock = require("spachcock");
var ws = new WebSocket('ws://echo.websocket.org');
var $ = new Spachcock();
$.route("/:first/:second", function (req, res) {
console.log(req.params);
});
$.response = ws.send;
@erayarslan
erayarslan / cute_process.txt
Created January 25, 2016 15:32
cute process
jobs - list the current jobs
fg - resume the job that's next in the queue
fg %[number] - resume job [number]
bg - Push the next job in the queue into the background
bg %[number] - Push the job [number] into the background
kill %[number] - Kill the job numbered [number]
kill -[signal] %[number] - Send the signal [signal] to job number [number]
disown %[number] - disown the process(no more terminal will be owner), so command will be alive even after closing the terminal.
@erayarslan
erayarslan / lel.js
Created December 12, 2015 17:21
lel
// localStorage.level = 1000; if u want : )
var click = function () {
document.body.dispatchEvent(new Event('mousedown'));
};
var getElementRotate = function (id) {
try {
var values = window
.getComputedStyle(document.getElementById(id), null)

#VIM

kntrl + o //open command line in vim

:colorschema =>press tab and select something
:syntax enable

:set number => show line number

if you want new schema