Skip to content

Instantly share code, notes, and snippets.

View dimayakovlev's full-sized avatar

Dmitry Yakovlev dimayakovlev

View GitHub Profile
@dimayakovlev
dimayakovlev / README.md
Created March 20, 2016 09:46
GravExampleAddVariableToTwig

Create a new plugin folder in user/plugins/example, and add those files:

user/plugins/example/example.php user/plugins/example/example.yaml

Then in your twig, you'll have the users object available:

{{ dump(users) }}

@dimayakovlev
dimayakovlev / datauri.php
Created December 9, 2016 12:42 — forked from rodneyrehm/datauri.php
PHP: datauri.php - convert image to data-uri
#!/opt/local/bin/php
<?php
/*
1) replace the shebang (first line) with the path to your php binary
(probably something like /usr/bin/php)
2) move the file to /usr/local/bin/datauri.php
(this should be in your PATH)
3) chmod ugo+rx /usr/local/bin/datauri.php
(make the script executable for everyone)
$(window).scroll(function() {
var st = $(this).scrollTop() /10;
$(".object").css({
"transform" : "translate3d(0px, " + st + "%, .01px)",
"-webkit-transform" : "translate3d(0px, " + st + "%, .01px)"
});
});
<!-- I got these buttons from simplesharebuttons.com -->
<div id="share-buttons">
<!-- Buffer -->
<a href="https://bufferapp.com/add?url=https://simplesharebuttons.com&amp;text=Simple Share Buttons" target="_blank">
<img src="https://simplesharebuttons.com/images/somacro/buffer.png" alt="Buffer" />
</a>
<!-- Digg -->
<a href="http://www.digg.com/submit?url=https://simplesharebuttons.com" target="_blank">
@dimayakovlev
dimayakovlev / smashingmagazine.js
Created August 5, 2017 14:41 — forked from luruke/smashingmagazine.js
Source code of the demo "Improving User Flow Through Page Transitions" on Smashing Magazine.
/*
https://www.smashingmagazine.com/2016/07/improving-user-flow-through-page-transitions/
You can copy paste this code in your console on smashingmagazine.com
in order to have cross-fade transition when change page.
*/
var cache = {};
function loadPage(url) {
if (cache[url]) {
<?php
/**
* GS 'Routing' demonstration module
*
* Demonstrates how to use "data_index" to modify the page data
* and how to use url segments to control process flows in your
* scripts.
*
* Required:
* --------------------------------------------------------------
@dimayakovlev
dimayakovlev / semantic-layout.html
Last active October 18, 2018 14:56 — forked from thomd/semantic-layout.html
Standard HTML5 Semantic Layout
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Title</title>
<link href="stylesheets/main.css" rel="stylesheet">
</head>
<body>
<header>
<h1>Header</h1>
/* ----------------------------------------------------------------------------------------------------
Super Form Reset
A couple of things to watch out for:
- IE8: If a text input doesn't have padding on all sides or none the text won't be centered.
- The default border sizes on text inputs in all UAs seem to be slightly different. You're better off using custom borders.
- You NEED to set the font-size and family on all form elements
- Search inputs need to have their appearance reset and the box-sizing set to content-box to match other UAs
@dimayakovlev
dimayakovlev / GitCommitBestPractices.md
Created February 16, 2022 12:31 — forked from luismts/GitCommitBestPractices.md
Git Tips and Git Commit Best Practices

Git Commit Best Practices

Basic Rules

Commit Related Changes

A commit should be a wrapper for related changes. For example, fixing two different bugs should produce two separate commits. Small commits make it easier for other developers to understand the changes and roll them back if something went wrong. With tools like the staging area and the ability to stage only parts of a file, Git makes it easy to create very granular commits.

Commit Often

Committing often keeps your commits small and, again, helps you commit only related changes. Moreover, it allows you to share your code more frequently with others. That way it‘s easier for everyone to integrate changes regularly and avoid having merge conflicts. Having large commits and sharing them infrequently, in contrast, makes it hard to solve conflicts.

@dimayakovlev
dimayakovlev / 55-bytes-of-css.md
Created October 1, 2022 05:49 — forked from JoeyBurzynski/55-bytes-of-css.md
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}