This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cloneStructuresPrimitives(input) { | |
// need checks on primitivesTypes, return input | |
return JSON.parse(JSON.stringify(input)); | |
} | |
export default function(name, WidgetClass) { | |
return $.fn[name] = function(opt){ | |
if (this.length > 0) return | |
baseOpt = opt || {}; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.cap = function () { | |
return this.charAt(0).toUpperCase() + this.slice(1); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Date.prototype.getWeekday = function(){ | |
var weekday = this.getDay() - 1; | |
if(weekday === -1) weekday = 6; | |
return weekday; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
callback: function (method) { | |
var self = this; | |
return (typeof self[method] === "function") | |
? function(){ | |
// добавляем оригинальный this последним аргументом | |
var args = _(arguments).toArray().value(); | |
args.push(this); | |
return self[method].apply(self, args); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('<script>', {src: '//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js'}).appendTo('head'); | |
$(function(){ | |
var arr = []; | |
$('*').each(function(i, el){ | |
var classe = $(el).attr('class'); | |
if(classe && classe.length) { | |
arr.push(classe.split(' ')); | |
} | |
}); | |
arr = _(arr).sortBy(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Grid system | |
// -------------------------------------------------- | |
//## Define your custom responsive grid. | |
//** Number of columns in the grid. | |
@grid-columns: 12; | |
//** Padding between columns. Gets divided in half for the left and right. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"backspace": "8", | |
"tab": "9", | |
"enter": "13", | |
"shift": "16", | |
"ctrl": "17", | |
"alt": "18", | |
"pause/break": "19", | |
"caps lock": "20", | |
"escape": "27", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"8": "backspace", | |
"9": "tab", | |
"13": "enter", | |
"16": "shift", | |
"17": "ctrl", | |
"18": "alt", | |
"19": "pause/break", | |
"20": "caps lock", | |
"27": "escape", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`import Em from 'ember'` | |
equal = (args..., options) -> | |
arr = for arg in args | |
value = @get(arg) | |
if typeof value isnt 'undefined' then value else arg | |
method = if _.isEqual.apply(_, arr) then 'fn' else 'inverse' | |
return options[method](@) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`import Ember from 'ember'` | |
oneormany = (length, value) -> | |
return "There are no #{value}s" if length is 0 | |
suffix = if length > 1 then 's' else '' | |
return "#{length} #{value}#{suffix}" | |
OneormanyHelper = Ember.Handlebars.helper 'oneormany', oneormany | |
`export { oneormany }` |
OlderNewer