A homage to all the Apple Mice over the years (made with pure CSS).
A Pen by Josh Bader on CodePen.
function setTextareaHeight(textarea, incCoeff) { | |
$textarea = $(textarea); | |
var lh = parseInt($textarea.css('line-height'), 10); | |
var sh = $textarea[0].scrollHeight; | |
var newHeight = sh + lh * incCoeff; | |
$textarea.height(lh); | |
if ($textarea.height() < newHeight) { | |
$textarea.height(newHeight); | |
} | |
} |
function Tape() {} | |
Tape.prototype = { | |
_curIndex:0, | |
_items: [0], | |
left: function() { | |
if (this._curIndex > 0) { | |
this._curIndex -= 1; | |
} | |
return this; | |
}, |
function cartesianProduct(array $arrayOfSets, array $tuple = array(), $n = 0) { | |
$size = count($arrayOfSets); | |
if ($n === $size) { | |
return array(); | |
} | |
$result = array(); | |
$set = $arrayOfSets[$n]; | |
foreach($set as $itemOfSet) { | |
// добавляем элемент множества в н-ку |
# MySQL | |
# | |
# Version 1 | |
# Use the Ubuntu base image from dotCloud | |
FROM ubuntu:12.04 | |
MAINTAINER Brian Shaw [email protected] | |
RUN dpkg-divert --local --rename --add /sbin/initctl |
var allowCrossDomain = function (req, res, next) { | |
res.header('Access-Control-Allow-Origin', "*"); | |
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE'); | |
// dojo sends X-Requested-With and If-None-Match (for insert) | |
res.header('Access-Control-Allow-Headers', 'Content-Type, X-Requested-With, If-None-Match'); | |
next(); | |
} |
function plural($num, $single, $plural, $plural4) { | |
$num_mod_10 = $num % 10; | |
$num_mod_100 = $num % 100; | |
return $num === 1 || $num_mod_100 > 20 && $num_mod_10 === 1 ? | |
$single : | |
(($num_mod_100 < 10 || $num_mod_100 > 20) && $num_mod_10 <= 4 ? | |
$plural4 : $plural); | |
} |
# Логирование | |
Это есть первая задача, которой я занялся, делая этот сервер. | |
Причина? Просто я солидарен с этим мнением: | |
> Я твердо уверен, что внедрить логирование в уже готовую программу без изменения архитектуры приложения – невозможно . | |
> Точнее внедрить можно, но тогда лог будет настолько страшным и неудобочитаемым, что остается посочувствовать | |
> тем администраторам, которые будут с ним работать.[1] |
define(function() { | |
// https://gist.github.com/addyosmani/1057989 | |
/** | |
Code copyright Dustin Diaz and Ross Harmes, Pro JavaScript Design Patterns. | |
**/ | |
// Constructor. | |
var Interface = function(name, methods) { |
A homage to all the Apple Mice over the years (made with pure CSS).
A Pen by Josh Bader on CodePen.
function a() { | |
var l=console.log; | |
a.f1=function(){l(arguments);} | |
a.f2=function(){l(arguments);} | |
} | |
// a(); | |
a.f1('test', 'm-m-m..!?'); |