Skip to content

Instantly share code, notes, and snippets.

View fupslot's full-sized avatar
💭
I may be slow to respond.

Eugene Brodsky fupslot

💭
I may be slow to respond.
View GitHub Profile
;(function($, window, document, undefined) {
'use strict';
var pluginName = 'FunnelViz'
, defaults = {
};
function init () {
@fupslot
fupslot / index.html
Last active August 29, 2015 14:06
title with action buttons
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Title with action buttons</title>
<style id="jsbin-css">
.bar {
position: relative;
}
it('Property', inject(function($parse){
function Property(context, fieldName) {
this.$getter = $parse(fieldName);
this.$setter = this.$getter.assign;
this.$context = context;
}
Property.prototype.get = function() {
return this.$getter(this.$context);
};
Property.prototype.set = function(value) {
@fupslot
fupslot / memoize
Last active August 29, 2015 14:27
Memoization For Improved Application Performance
function memoize(fn) {
fn.memoize || (fn.memoize = {});
return function(arg) {
if (fn.memoize.hasOwnProperty(arg)) {
console.log('memoized //-> %s', arg);
return fn.memoize[arg];
}
else {
console.log('computed //-> %s', arg);
fn.memoize[arg] = fn(arg);
if (document.addEventListener) {
document.addEventListener('contextmenu', function(e) {
alert("You've tried to open context menu"); //here you draw your own menu
e.preventDefault();
}, false);
} else {
document.attachEvent('oncontextmenu', function() {
alert("You've tried to open context menu");
window.event.returnValue = false;
});
@fupslot
fupslot / abbriviate.js
Created August 24, 2015 13:10
abbriviate, ellipsis, filter, anguar
angular
.module('myProject', [])
.filter('abbreviate', function () {
// Hello World | abbreviate:6:2 //-> 'Hello...Wo'
// Hello World | abbreviate:5 //-> 'Hello...'
return function(str, num, prefix) {
if (str == null) { str = ''; }
if (num == null) { num = str.length; }
if (prefix == null) { prefix = 0; }
@fupslot
fupslot / gist:4068317
Created November 13, 2012 20:52 — forked from padolsey/gist:527683
JavaScript: Detect IE
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@fupslot
fupslot / uri.js
Created November 14, 2012 13:30 — forked from jlong/uri.js
JavaScritp: URI Parsing
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@fupslot
fupslot / jquery.ba-tinypubsub.min.js
Created November 14, 2012 13:34 — forked from cowboy/HEY-YOU.md
jQuery: Tiny Pub/Sub
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function(a){var b=a({});a.subscribe=function(){b.on.apply(b,arguments)},a.unsubscribe=function(){b.off.apply(b,arguments)},a.publish=function(){b.trigger.apply(b,arguments)}})(jQuery)
@fupslot
fupslot / gist:4125997
Created November 21, 2012 16:51
Chrome: Get Tabs
var w = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var win = w.getMostRecentWindow("navigator:browser");
for (var i = win.gBrowser.tabs.length - 1; i >= 0; i--) {
var browser = win.gBrowser.tabs[i].linkedBrowser;
var cd = browser.contentDocument;
var cw = browser.contentWindow;