Skip to content

Instantly share code, notes, and snippets.

View v0lkan's full-sized avatar
🎸
totally rocking it 🚀.

Volkan Özçelik v0lkan

🎸
totally rocking it 🚀.
View GitHub Profile
// This...
exports.find = function(queue, query, callback) {
switch(queue) {
case 'today':
return callback(null, {
query: query,
realm: 'today',
goals: privates.getTodayGoals(query)
});
<begin:braindump>
http://bonsaiden.github.io/JavaScript-Garden/
http://www.jblotus.com/2013/01/13/common-javascript-gotchas/
http://www.adequatelygood.com/JavaScript-Module-Pattern-In-Depth.html
http://singlepageappbook.com/single-page.html
http://www.codethinked.com/preparing-yourself-for-modern-javascript-development
http://www.html5rocks.com/en/
http://sporto.github.io/blog/2012/12/09/callbacks-listeners-promises/
https://gist.github.com/desandro/4686136
http://msdn.microsoft.com/en-us/magazine/ff852808.aspx
@v0lkan
v0lkan / consolefix.js
Created June 11, 2014 23:11
makes console.log display method and line info.
var methods = ['log', 'warn'], i, len, old;
for (i = 0, len = methods.length; i < len; i++){
old = console[methods[i]];
console[methods[i]] = function() {
var stack = (new Error()).stack.split(/\n/);
if (stack[0].indexOf('Error') === 0) {stack = stack.slice(1);}
@v0lkan
v0lkan / maybe.js
Last active August 29, 2015 14:02
A quick namespace resolver.
function maybe(obj, path, defaultValue) {
if (obj == null) {return undefined;}
var reduced = path.split('.').reduce(function(memo, attr) {
if (memo == null) {return undefined;}
return memo[attr];
}, obj);
return reduced === undefined ? defaultValue : reduced;
var app = require('express')(),
server = require('http').Server(app),
io = require('engine.io').attach(server);
// Use this middleware to workaround "Access-Control-Allow-Origin" errors on the client.
app.use(function (req, res, next) {
res.setHeader('Access-Control-Allow-Origin', "http://theWebsiteThatOpensSocketConnection.com");
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
res.setHeader('Access-Control-Allow-Credentials', 'true');
@v0lkan
v0lkan / frameworks.md
Last active August 29, 2015 14:05
Do You Rely On Any Frameworks?

This is an excerpt from an interview that I had recently.

Just wanted to share.

Volkan


Since how long do you develop for the web ? Front-end or Back-end?

@v0lkan
v0lkan / gruvbox-terminal.vim
Created August 18, 2014 23:13
My current color scheme.
" -----------------------------------------------------------------------------
" Almost 99% Based on gruvbox.vim
" Description: Retro groove color scheme for Vim
" Author: morhetz <morhetz@gmail.com>
" Source: https://github.com/morhetz/gruvbox
" -----------------------------------------------------------------------------
" Supporting code -------------------------------------------------------------
" Initialisation: {{{
@v0lkan
v0lkan / dsaqdcs.md
Last active January 14, 2023 23:22
Data Structures and Algorithms Quick And Dirty Cheat Sheet

Caveat

The tables in this cheatsheet only make sense after you study all thes mentioned data structures and algorithms below.

Do not memorize them, learn how the underlying algorithms work, read the source.

This cheat sheet is just a quick reference to give an broad brush strokes overview of how the most frequently-used data structures and algorithms relate to each other, in terms of time and space complexity.

@v0lkan
v0lkan / app.js
Last active August 29, 2015 14:06
#nodejs #tip Tame your dependencies with a `rekuire` function ;)
// ----------------------------------------------------------------------------
// File: PROJECT_ROOT/ ... / servers/app1/app.js
// Define this **before** all the `require`s.
function initRekuire(baseDir, appDir) {
var base = baseDir || '.',
app == appDir || '.';
global.rekuire = function(name) {
return require(
// ## Every console needs a WTF prompt.
// Method:
console.wtf = function() {
console.warn.apply(console,
['(W)hat a (T)errible (F)ailure »» '].concat(
Array.prototoype.slice.call(arguments)
)
);
};