Skip to content

Instantly share code, notes, and snippets.

View mgechev's full-sized avatar
🚀
Better Web

Minko Gechev mgechev

🚀
Better Web
View GitHub Profile
  1. Node.js wrapper of freerdp
  2. Single-page web app with MEAN
  3. "TeamViewer" through VNC (i.e. node.js proxy for RFB protocol)
  4. Multiplayer game - Tanks
/*!
* Bowser - a browser detector
* https://github.com/ded/bowser
* MIT License | (c) Dustin Diaz 2013
*/
!function (name, definition) {
if (typeof define == 'function') define(definition)
else if (typeof module != 'undefined' && module.exports) module.exports['browser'] = definition()
else window[name] = definition()
var rooms = [
{
"type": "Двустаен",
"size": 100,
"url": "http://www.homes.bg/ar130460",
"phone": "0879354498",
"location": "Ул./Бул. Тодор Александров",
"price": 270
},
{
@mgechev
mgechev / host-location.js
Last active December 21, 2015 08:38
Host location
var getHostLocation = function() {
if (getHostLocation.hostLocation === undefined) {
var loc = window.location;
getHostLocation.hostLocation = loc.protocol + "//" + loc.hostname + ((loc.port !== undefined) ? ':' + loc.port : '');
}
return getHostLocation.hostLocation;
};
@mgechev
mgechev / config-snippet.js
Created August 18, 2013 09:23
Config snippet
App.config = (function () {
var CONFIG = {
port: 8080,
appname: 'foo',
//...
};
return {
getProperty: function (prop) {
prop = prop.toLowerCase();
return CONFIG[prop];
@mgechev
mgechev / fibonacci.js
Created August 12, 2013 13:40
Fibonacci in JavaScript
var fib = function (_) {
for (_=[+[],++[[]][+[]],+[],_],_[++[++[++[[]][+[]]][+[]]][+[]]]=(((_[++[++[++[[]][+[]]][+[]]][+[]]]-(++[[]][+[]]))&(((--[[]][+[]])>>>(++[[]][+[]]))))===(_[++[++[++[[]][+[]]][+[]]][+[]]]-(++[[]][+[]])))?(_[++[++[[]][+[]]][+[]]]=++[[]][+[]],_[++[++[++[[]][+[]]][+[]]][+[]]]-(++[[]][+[]])):+[];_[++[++[++[[]][+[]]][+[]]][+[]]]--;_[+[]]=(_[++[[]][+[]]]=_[++[++[[]][+[]]][+[]]]=_[+[]]+_[++[[]][+[]]])-_[+[]]);
return _[++[++[[]][+[]]][+[]]];
}
@mgechev
mgechev / array-pull-primitives.js
Last active December 20, 2015 23:08
Array pull with primitives
function pullPrimitives(arr) {
var map = {},
res = [],
len = arr.length,
args = arguments,
current;
for (var i = 1, argsLen = args.length; i < argsLen; i++) {
map[args[i]] = true;
}
for (i = 0; i < len; i++) {
@mgechev
mgechev / quicksort.hs
Created July 12, 2013 18:17
Quick sort in Haskell
quickSort :: Ord a => [a] -> [a]
quickSort [] = []
quickSort (x:xs) = quickSort left ++ [x] ++ quickSort right
where
left = [ y | y <- xs, y < x ]
right = [ y | y <- xs, y >= x ]
@mgechev
mgechev / sublist-sum.hs
Created July 5, 2013 11:00
The sum of all sub lists of given list which don't have negative values in them
sumProd :: [[Integer]]->Integer
sumProd lst = sum (map product (filter (\x -> length ([y | y <- x, y < 0]) == 0) lst))
@mgechev
mgechev / di-topics-random-generator.perl
Created July 5, 2013 10:59
Random generator for the topics to re-study...
#!/usr/bin/perl
use warnings;
use strict;
use constant NUM_PER_DAY => 5;
use constant TOTAL_TOPICS => 24;
my @topics = (1..TOTAL_TOPICS);
my ($rand, $temp);