Skip to content

Instantly share code, notes, and snippets.

View ar7n's full-sized avatar
🪲
working hard

Arseny Sysolyatin ar7n

🪲
working hard
View GitHub Profile
@ar7n
ar7n / fontface.less
Last active August 29, 2015 14:24
Font-face less mixin
.include-custom-font(@family: arial, @file: arial, @weight: normal, @style: normal){
@font-face{
font-family: @family;
src:url('/fonts/@{file}.eot');
src:url('/fonts/@{file}.eot?#iefix') format('embedded-opentype'),
url('/fonts/@{file}.woff') format('woff'),
url('/fonts/@{file}.ttf') format('truetype'),
url('/fonts/@{file}.svg#icon') format('svg');
font-weight: @weight;
font-style: @style;
@ar7n
ar7n / media-queries.less
Last active August 29, 2015 14:24
Bootstrap media queries
@media(max-width:767px){} // xs
@media(min-width:768px) and (max-width:991px){} // sm
@media(min-width:992px) and (max-width:1199px){} // md
@media(min-width:1200px){} // lg
@media(max-width:991px){} // xs - sm
@media(max-width:1199px){} // xs - md
@media(min-width:768px) and (max-width:1199px){} // sm - md
@media(min-width:768px){} // sm - lg
@media(min-width:992px){} // md - lg
@ar7n
ar7n / scroll-to.js
Created July 12, 2015 09:02
jQuery scroll to element
$("#button").click(function() {
$('html, body').animate({
scrollTop: $("#elementtoScrollToID").offset().top
}, 2000);
});
@ar7n
ar7n / devdependencies.js
Created July 16, 2015 08:31
Gulp dev dependencies
"devDependencies": {
"browser-sync": "^2.2.1",
"del": "^1.1.1",
"gulp": "^3.8.11",
"gulp-concat": "^2.5.2",
"gulp-filter": "^2.0.2",
"gulp-less": "^3.0.1",
"gulp-minify-css": "^1.1.1",
"gulp-uglify": "^1.2.0",
"gulp-util": "^3.0.4",
@ar7n
ar7n / comments.css
Last active August 29, 2015 14:26
Idiomatic css comments style
/* ==========================================================================
Section comment block
========================================================================== */
/* Sub-section comment block
========================================================================== */
/**
* Short description using Doxygen-style comment format
*
@ar7n
ar7n / installphp7.sh
Created December 4, 2015 06:30 — forked from tronsha/installphp7.sh
Install PHP7 to Ubuntu
#!/bin/bash
apt-get update
apt-get install -y git-core autoconf bison libxml2-dev libbz2-dev libmcrypt-dev libcurl4-openssl-dev libltdl-dev libpng-dev libpspell-dev libreadline-dev
mkdir -p /etc/php7/conf.d
mkdir -p /etc/php7/cli/conf.d
mkdir /usr/local/php7
cd /tmp
git clone https://github.com/php/php-src.git --depth=1
cd php-src
./buildconf
@ar7n
ar7n / KeystoneApiExample.md
Created January 22, 2016 10:26 — forked from JedWatson/KeystoneApiExample.md
Example of how to scaffold API endpoints for Posts in a Keystone project (based on the yo keystone example).

This is an example of how to scaffold API endpoints to list / get / create / update / delete Posts in a Keystone website.

It's a modification of the default project created with the yo keystone generator (see https://github.com/JedWatson/generator-keystone)

Gists don't let you specify full paths, so in the project structure the files would be:

routes-index.js        -->    /routes/index.js         // modified to add the api endpoints
routes-api-posts.js    -->    /routes/api/posts.js     // new file containing the Post API route controllers
@ar7n
ar7n / count-ip-requests.sh
Created February 4, 2016 11:55
Count the number of requests from IPs
cat access.log | awk '{print $1}' | sort -n | uniq -c | sort -nr | head -20
@ar7n
ar7n / regexp.js
Created February 4, 2016 13:30
Regexps
# Email
/^(([a-zA-Z]|[0-9])|([-]|[_]|[.]))+[@](([a-zA-Z0-9])|([-])){2,63}[.](([a-zA-Z0-9]){2,63})+$/gi;
# Russian phone number
/^((8|\+7)[\- ]?)?(\(?\d{3}\)?[\- ]?)?[\d\- ]{7,10}$/g;
@ar7n
ar7n / sendmail.php
Created February 4, 2016 13:56
Send email by php
<?php
$headers = array();
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-type: text/html; charset=utf-8";
$headers[] = "From: Sender Name <[email protected]>";
$headers[] = "Bcc: JJ Chong <[email protected]>";
$headers[] = "Reply-To: Recipient Name <[email protected]>";
$headers[] = "Subject: {$subject}";
$headers[] = "X-Mailer: PHP/".phpversion();