Skip to content

Instantly share code, notes, and snippets.

<script>console.log({"block":"page","elem":null,"mix":{"0":{"block":"user","elem":null,"mix":null,"content":null,"tag":null,"html":null,"js":{"logged":true,"profile_url":"http:\/\/vrukodelii.dev\/users\/unic","avatar_url":"http:\/\/vrukodelii.dev\/attachments\/avatar_small.png","menu":[{"icon":"user","url":"http:\/\/vrukodelii.dev\/users\/unic","name":"Mo\u0439 \u043f\u0440\u043e\u0444\u0438\u043b\u044c"},{"icon":"edit","url":"http:\/\/vrukodelii.dev\/users\/unic\/posts","name":"Mo\u0438 \u0440\u0430\u0431\u043e\u0442\u044b"},{"icon":"settings","url":"http:\/\/vrukodelii.dev\/my\/settings","name":"Mo\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438"},{"icon":"user","url":"http:\/\/vrukodelii.dev\/admin","name":"\u0410\u0434\u043c\u0438\u043d\u043a\u0430"},{"icon":"power-off","url":"http:\/\/vrukodelii.dev\/logout","name":"\u0412\u044b\u0439\u0442\u0438"}]},"jsAttr":null,"bem":null,"cls":null,"attrs":null,"_stop":false,"_matcherCalls":0,"_m":[]}},"content":{"0":{"block":"header","elem":null,"mix":n
<?php
return function ($bh) {
$bh->match('breadcrumbs', function ($ctx, $json) {
if (!$ctx->param('data')) {
return;
}
foreach ($json->data as $item) {
$mod = isset($item['active']) ? true : false;
if (isset($item['url'])) {
@un1ko85
un1ko85 / sm-annotated.html
Created October 27, 2015 08:49 — forked from hdragomir/sm-annotated.html
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@un1ko85
un1ko85 / site.conf
Last active August 29, 2015 14:22 — 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
@un1ko85
un1ko85 / fonts.styl
Last active August 29, 2015 14:18 — forked from diogomoretti/fonts.styl
// Fonts mixin
font-url(file)
return '../fonts/' + file
webfont(family, file, hack-chrome-windows = false, weight = 'normal')
@font-face
font-family family
src url(font-url(file + '.eot'))
src url(font-url(file + '.eot?#iefix')) format('embedded-opentype'),
url(font-url(file + '.woff')) format('woff'),
({
block : 'page',
title : 'grid',
head : [
{elem: 'css', url: '_grid.css'}
],
scripts: [{elem: 'js', url: '_grid.js'}],
content: [
{
block : 'content',
@un1ko85
un1ko85 / new_gist_file.php
Created November 29, 2013 08:53
use email from SMTP hook
add_action( 'phpmailer_init', 'wpse8170_phpmailer_init' );
function wpse8170_phpmailer_init( PHPMailer $phpmailer ) {
$phpmailer->Host = 'your.smtp.server.here';
$phpmailer->Port = 25; // could be different
$phpmailer->Username = 'your_username@example.com'; // if required
$phpmailer->Password = 'yourpassword'; // if required
$phpmailer->SMTPAuth = true; // if required
// $phpmailer->SMTPSecure = 'ssl'; // enable if required, 'tls' is another possible value
$phpmailer->IsSMTP();
server {
listen 127.0.0.1:80;
server_name nocache.domain.tld;
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|js|swf|txt|ico)$ {
allow 127.0.0.1;
deny all;
root /path/to/fuse/filesystem;
}
}
server {
[...]
set $cache_uri $request_uri;
# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
set $cache_uri 'null cache';
}
if ($query_string != "") {
set $cache_uri 'null cache';
@un1ko85
un1ko85 / facebooklike.js
Created October 25, 2013 16:28
Facebook: как посчитать количество лайков
$.getJSON('https://graph.facebook.com/fql?q=select like_count, share_count from link_stat where url="' + encodeURI(page_url) + '"'
+ '&callback=?', function(response) {
var count = 0;
if (response.data !== undefined) {
if (response.data[0].like_count !== undefined) {
count += response.data[0].like_count;
}
if (response.data[0].share_count !== undefined) {
count += response.data[0].share_count;
}