Skip to content

Instantly share code, notes, and snippets.

View finethanks's full-sized avatar
🚀
To the moon

Oleg Viktorovich finethanks

🚀
To the moon
View GitHub Profile
@finethanks
finethanks / resize.php
Created October 20, 2017 11:28
Функция ресайза изображений
<?php
/**
* Ресайзер изображений. Ибо CFile::ResizeImageGet не умеет увеличивать
* @param mixed $imageFile ID файла, массив, либо путь
* @param array $arSize размеры результата
* @return array
*/
function ImageResize($image, $arSize = array(100, 100), $crop = true) {
if (is_array($image) && $image["SRC"] != "") {
$imageFile = $image["SRC"];
@finethanks
finethanks / docker-compose.yml
Created October 12, 2017 07:31
docker-compose example
# запуск docker-compose -f ../docker-compose.yml up --build
# запускается из папок dev и prod с разными .env, в которых настроены порты, пути, пароли и т.п.
version: '3.3'
services:
nginx:
container_name: ${TITLE}_nginx
build:
context: ./../nginx
ports:
docker rm $(docker ps -a -q)
docker rmi $(docker images -q -f dangling=true)
@finethanks
finethanks / webpack.config.js
Created June 8, 2017 07:27
extract plugin не резовит свою папку в node_modules
const path = require('path');
const NODE_ENV = process.env.NODE_ENV || 'development';
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const extractSass = new ExtractTextPlugin("style.css");
const nodeModulesPath = path.resolve(__dirname, '', 'node_modules');
const assetsPath = path.resolve(__dirname, '', 'templates/src');
const buildPath = path.resolve(__dirname, '', 'templates/.default');
module.exports = {
@finethanks
finethanks / logs.php
Created February 3, 2015 09:59
date_diff
$date1 = new DateTime('03.01.2015');
$date2 = new DateTime('12.01.2015');
$a = date_diff($date1, $date2);
$str = $a->format('%d дней');
@finethanks
finethanks / returnjson.php
Created January 23, 2015 10:49
#json #php возвращает в качестве ответа JSON
function returnJSON($stdObject) {
$jsonBefore = json_encode($stdObject, JSON_UNESCAPED_UNICODE);
$jsonAfter = preg_replace("/\\\\\//", "/", $jsonBefore);
header("Content-Type: application/json; charset=utf-8;");
echo $jsonAfter;
}
@finethanks
finethanks / guidjs.js
Created January 23, 2015 09:20
GUID generator #javascript
function guid(){
var S4 = function () {
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
};
return (S4() + S4() + "-" + S4() + "-4" + S4().substr(0,3) + "-" + S4() + "-" + S4() + S4() + S4()).toLowerCase();
}
@finethanks
finethanks / css_resources.md
Created January 15, 2014 06:51 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@finethanks
finethanks / javascript_resources.md
Created January 15, 2014 06:51 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage