Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Kalygin mkalygin

View GitHub Profile
@mkalygin
mkalygin / add-script.js
Last active Dec 24, 2015
Add Script to DOM
View add-script.js
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 Dec 21, 2015
jQuery Mini Widget
View miniwidget.js
$.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 Aug 2, 2013
JavaScript submodule with jQuery.
View submodule.js
var Module = (function (Module, window, $) {
var SubModule = Module.SubModule = Module.SubModule || {};
$.extend(SubModule, {
initialize: function () {
}
});
return Module;
}(Module || {}, window, jQuery));