Skip to content

Instantly share code, notes, and snippets.

@erayarslan
erayarslan / backbone.mw.js
Created January 16, 2017 10:31
express like middleware thing for backbone.js (again 'n again)
/**
* @module backbone.mv
* @author Eray Arslan <relfishere@gmail.com>
* @data 11.01.2017
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
define(['backbone', 'underscore'], factory);
} else if (typeof exports === 'object') {
@erayarslan
erayarslan / backbone.middleware.js
Created January 12, 2017 08:21
backbone.middleware.js
/**
* @module backbone.middleware
* author eray <relfishere@gmail.com>
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
define(['backbone', 'underscore'], factory);
} else if (typeof exports === 'object') {
module.exports = factory(require('backbone'), require('underscore'));
@erayarslan
erayarslan / flack.js
Created January 9, 2017 23:48
flack.js
(function () {
var root = this;
var flack = function (limit, blackList) {
this.blackList = typeof blackList === "undefined" ? [] : blackList;
this.limit = typeof limit === "undefined" ? 50 : parseInt(limit);
this.obj = {};
};
if (typeof exports !== "undefined") {
@erayarslan
erayarslan / n3xt.js
Created January 9, 2017 23:46
n3xt.js
(function () {
var n3xt = function (arr) {
var _slice = Array.prototype.slice;
(function _n(i) {
return i != arr.length ? (function () {
arr[i].apply(this, _slice
.call(arguments)
.concat(_n(i + 1).bind(this)));
}).bind(this) : function () {
};
@erayarslan
erayarslan / glClick.js
Created January 5, 2017 08:45
angular click to route trigger for links
/**
* @author Eray Arslan
* @description backbone click to route trick implementation
*/
(function () {
'use strict';
angular.module('app')
.directive('glClick', glClick);
@erayarslan
erayarslan / app.js
Created January 5, 2017 08:42
mongodb health checker
var isAlive = require("./is-alive");
var Config = require("./config");
var app = new isAlive(Config.mongodb)
.mail(Config)
.success(function (db) {
console.log("[IS-ALIVE] alive!");
this.setStatus(false);
db.close();
})
@erayarslan
erayarslan / web-servers.md
Created December 23, 2016 10:39 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@erayarslan
erayarslan / fetch_as_google_with_curl.txt
Last active November 29, 2016 08:10
fetch as google with curl
curl --user-agent "Googlebot/2.1 (+http://www.google.com/bot.html)" -v http://thisistest.site/entry/953
curl -o /dev/null -s -w "%{time_connect} + %{time_starttransfer} = %{time_total}\n" http://thisistest.site/entry/953
@erayarslan
erayarslan / reflex.js
Created November 10, 2016 07:53
reflex.js
// reflex.js 0.0.1
// (c) 2014 Eray Arslan
// reflex may be freely distributed under the MIT license.
//
// fast || smooth , calculation <3 javascript || node.js
var reflex = function() {
var params = [];
for(var i = 0; i < arguments.length; i++) {
@erayarslan
erayarslan / _if.js
Created November 10, 2016 07:52
_if.js
(function (global) {
"use strict";
global._if = function () {
var args = arguments;
if (args.length == 3) {
(args[0] ? args[1] : args[2])();
} else if (args.length == 4) {
args[0] ? setTimeout(args[1], args[3]) : setTimeout(args[2], args[3]);