Skip to content

Instantly share code, notes, and snippets.

View mkalygin's full-sized avatar

Michael Kalygin mkalygin

View GitHub Profile
@mkalygin
mkalygin / add-script.js
Last active December 24, 2015 14:09
Add Script to DOM
function addScript(path) {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = path;
document.getElementsByTagName("head")[0].appendChild(script);
}
@mkalygin
mkalygin / miniwidget.js
Last active December 21, 2015 07:28
jQuery Mini Widget
$.fn.miniwidget = function () {
var self = this;
return $.extend(true, self.each(function () {
var $this = $(self);
// initialization...
}), {
method: function () {
return self.each(function () {
var $this = $(this);
@mkalygin
mkalygin / submodule.js
Created August 2, 2013 00:41
JavaScript submodule with jQuery.
var Module = (function (Module, window, $) {
var SubModule = Module.SubModule = Module.SubModule || {};
$.extend(SubModule, {
initialize: function () {
}
});
return Module;
}(Module || {}, window, jQuery));