Skip to content

Instantly share code, notes, and snippets.

View frontdevops's full-sized avatar
:octocat:
Develop 𝔾𝕖𝕖𝕜𝕁𝕆𝔹

Sasha Majorović frontdevops

:octocat:
Develop 𝔾𝕖𝕖𝕜𝕁𝕆𝔹
View GitHub Profile
@frontdevops
frontdevops / site.conf
Last active August 29, 2015 14:16 — forked from paskal/site.conf
# read more at https://terrty.net/2014/ssl-tls-in-nginx/
# latest version on https://gist.github.com/paskal/628882bee1948ef126dd/126e4d1daeb5244aacbbd847c5247c2e293f6adf
# security test score: https://www.ssllabs.com/ssltest/analyze.html?d=terrty.net
# your nginx version might not have all directives included, test this configuration before using in production against your nginx:
# $ nginx -c /etc/nginx/nginx.conf -t
server {
# public key, contains your public key and class 1 certificate, to create:
# (example for startssl)
# $ (cat example.com.pem & wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem) | tee -a /etc/nginx/ssl/domain.pem > /dev/null
@frontdevops
frontdevops / what-forces-layout.md
Last active September 21, 2015 07:49 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
# add this file in your .bashrc file:
# source docker.sh
dockerip() {
docker inspect --format '{{ .NetworkSettings.IPAddress }}' "$@"
}
dockerips() {
for dock in $(docker ps | tail -n +2 | cut -d" " -f1)
do
/**
* ConcreteComponent
* (класс для последующего декорирования)
*/
class Coffee {
getCost(defCost:number = 1):number {
return defCost;
}
}
/**
* ConcreteComponent
* (класс для последующего декорирования)
*/
class Coffee {
private cost:number = 1;
getCost():number { return this.cost; }
}
abstract class CoffeeItem {
/**
* ConcreteComponent
* (класс для последующего декорирования)
*/
class Coffee {
private cost :number = 1;
getCost() :number {
return this.cost;
}
/**
* Base decorator for Coffee ingredients
* @param target
* @param cost
* @returns {any}
*/
function baseCoffeeIngredientDecorator(target, cost) {
// save a reference to the original constructor
var original = target;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
/**
* Base decorator for Coffee ingredients
* @param target
* @param cost
function log<T>(target: T, key :string, descriptor :any): T {
var originalMethod = descriptor.value;
descriptor.value = function (...args :any[]) :any {
let result = originalMethod.apply(this, args);
console.log(`Call: ${key}(${args.map(a=>JSON.stringify(a)).join()}) => ${JSON.stringify(result)}`);
return result;
};