Variables: muchVar = soValue
Making global var: global.muchVar = soValue
Objects:
muchObj =
soProp: "wow"
One of javascript pitfalls is object constructor: if you forgot to add new
before your function, it will not be called as constructor, but as usual function.
This code allows you to use style
tag with src
attribute, just like script
.
Merely for fun. Don't use it on production, because browser could not cache and load styles asynchronously.
(function() {
var styleTags = document.querySelectorAll('style');
for (var i = 0, l = styleTags.length; i < l; ++i) {
(function(el){
var src = el.getAttribute('src');
if(src.length > 0) {
infinityScroller = function() { | |
this.el = $(/*wrapper-class*/); | |
this.blocks = function() { return this.el.children(/*item class*/) }; //function to prevent jquery snapshot | |
this.maxShift = this.blocks.length - 3; //only 3 at screen | |
this.indent(this.indent() - this.shiftPx); //make last first and move off screen | |
this.blocks().last().detach().insertBefore(this.blocks().first()); | |
}; | |
feedTagsPromo.prototype = { | |
shiftNum: 0, //counter for left displayed item |
var created = new Date(opinion.created), timeFormatted, distance = ~~((new Date() - created) / 86400000); | |
var hours = created.getHours().toString().length === 1 ? '0' + created.getHours() : created.getHours(); | |
var minutes = created.getMinutes().toString().length === 1 ? '0' + created.getMinutes() : created.getMinutes(); | |
timeFormatted = hours + ':' + minutes; | |
switch(distance) { | |
case 0: | |
break; | |
case 1: | |
timeFormatted = "вчера в " + timeFormatted; | |
break; |
I hereby claim:
To claim this, I am signing this object:
/* Delete semicolon after any rule — only that rule and the next rule would not apply */ | |
/* @marinintim */ | |
.autosize { | |
height: auto; | |
min-width: 20em; | |
min-height: 4em; | |
box-sizing: border-box; | |
overflow: visible; | |
} |
var cheerio = require('cheerio'), | |
iconv = require('iconv-lite'), | |
sizeOf = require('image-size'), | |
fs = require('fs'); | |
iconv.extendNodeEncodings(); //to use win1251 as node encoding | |
//extract filename from PHP method | |
function getFilenameFromGetUrld(str) { | |
var newStr = str.substr(str.indexOf("'") + 1) |
<2>Trying to authenticate with 00:55:ab:25:ac:5a (SSID=’WLAN-Network’ freq=2437 MHz) | |
<2>Trying to associate with 00:55:ab:25:ac:5a (SSID=’WLAN-Network’ freq=2437 MHz) | |
<2>Associated with 00:55:ab:25:ac:5a | |
<2>WPA: Key negotiation completed with 00:55:ab:25:ac:5a [PTK=CCMP GTK=CCMP] | |
<2>CTRL-EVENT-CONNECTED — Connection to 00:55:ab:25:ac:5a completed (reauth) [id=0 id_str=] |
.wrapper { | |
border: 1px solid #111; | |
white-space: nowrap; | |
height: 700px; | |
width: 960px; | |
} | |
.left {width: 270px; background: grey; height: 100%;} | |
.right { width: 690px; height: 100%; position: relative; } | |
.left, .right { |