Skip to content

Instantly share code, notes, and snippets.

View kamilogorek's full-sized avatar

Kamil Ogórek kamilogorek

View GitHub Profile

GIT WORKFLOW OF OUR CHOICE - FORKS WITH FEATURE BRANCHES

Git is well-known and lately pretty popular version control system, which helps developers to take care of their codebases.

Unlike SVN, it's decentralised and it lets you work locally, without any internet access, what can save your precious time more often then you may actually think. On the other hand it beats Mercurial with it's massive number of functionalities, which may be sometimes overwhelming for some of the developers.

Git has conquered whole internet surprisingly fast, therefore we also decided to take an advantage of it in our current projects.

For a lot of developers teams, starting to work using brand new system rises a lot of questions, from among which, the most important one is how they should settle their workflow.

@kamilogorek
kamilogorek / renditions-sort.js
Last active December 22, 2015 06:58
Sorting renditions ratio
<script type="text/javascript">
var fapiResponse = {{ albums[0].photos[0].images | json_encode | raw }};
var renditions = [];
var ratios = {};
for (key in fapiResponse) {
renditions.push(key.split('_retina')[0]);
}
renditions.map(function(rendition, i) {
window.changeURL = function(photo) {
// not HTML history API browsers
if ($('html').hasClass('ie8') || $('html').hasClass('ie9')) {
window.location = photo.url;
}
else {
var stateObj = { video: 'xfactor' };
history.pushState(stateObj, photo.description, photo.url);
}
};
@kamilogorek
kamilogorek / vim-tips
Created May 19, 2013 22:27
Useful vim commands
# Reindent whole file
gg=G
@kamilogorek
kamilogorek / Navigation icons
Created May 8, 2013 09:19
Navigation icons with scalable sprite image
@mixin control-icon($dir, $size:76px) {
$icons-count: 4;
width: $size;
height: $size;
display: inline-block;
background: url(../img/ico-controls.png);
background-size: ($size*2) ($size*$icons-count);
background-repeat: no-repeat;
cursor: pointer;
@kamilogorek
kamilogorek / Equal cells width
Created May 8, 2013 09:16
Equal cells width within table columns
var cells = [];
var header = $('table').find('tr:first').find('th');
var rows = $('table').find('tr').not(':first');
header.each(function(i, val){
cells.push($(val).width());
});
rows.each(function(i, val) {
var _this = this;
@kamilogorek
kamilogorek / Characters encoding
Created May 8, 2013 09:00
Characters encoding
function encodeString(str) {
return str.replace(/\\n/g, '\n').replace(/\\'/g, '\'').replace(/\\"/g, '\"').replace(/\\\\/g, '\\');
}
@kamilogorek
kamilogorek / Missed border on rotate
Created May 8, 2013 08:58
Missed border on rotate
selector {
@include backface-visibility(hidden);
@include perspective(1000);
}
@kamilogorek
kamilogorek / Carousel iteration logic
Created May 8, 2013 08:53
Carousel iteration logic
@kamilogorek
kamilogorek / Convert image to base64
Created April 15, 2013 10:13
Convert image to base64
with(document)with(i=querySelector('img'),createElement('canvas'))width=i.width,height=i.height,getContext('2d').drawImage(i,0,0),toDataURL()