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.

<code>$ mkdir [your-project]</code>
<code>$ cd [your-project]</code>
<code>$ git init</code>
<code>$ git remote add origin [repo-url]</code>
<code>$ touch README.md (to create README file)</code>
<code>$ git add README.md</code>
<code>$ git commit -m "Init commit"</code>
<code>$ git push origin master -u</code>
@kamilogorek
kamilogorek / diff.html
Created October 21, 2013 17:38
scoreunder/lodash 1.3.0 diff
<html>
<head>
<title>Scoreunder/LoDash Diff</title>
<style type="text/css">
body {
padding: 2em;
font: 18px Monaco;
}
.add {
background: rgba(0,255,0,0.1);
@kamilogorek
kamilogorek / lessphp-grunt-task.js
Created November 15, 2013 00:41
Task for building LESS files using LESSPHP
module.exports = function(grunt) {
'use strict';
var execSync = require('exec-sync');
grunt.initConfig({
lessphp: {
files: {
'path/to/source.less': 'path/to/compiled.css',
}
(function makeThanksgivingHappen (wishes) {
function Thanks () {
this.given = false;
}
Thanks.prototype.give = function () {
this.given = true;
}
var thanks = new Thanks();
@kamilogorek
kamilogorek / livereload-snippet.html
Created January 12, 2014 15:52
Static node.js server with livereload
<script>document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>')</script>
@kamilogorek
kamilogorek / wait-for-images.js
Created February 5, 2014 08:49
Wait for all images to load before executing callback
'use strict';
module.exports = function (element, callback) {
var allImgsLength = 0;
var allImgsLoaded = 0;
var allImgs = [];
var filtered = Array.prototype.filter.call(element.querySelectorAll('img'), function (item) {
if (item.src === '') {
return false;
@kamilogorek
kamilogorek / hub-commits.sh
Last active August 29, 2015 13:56
Hub Workflow Snippets
$ git remote add <username> <fork-url>
$ git fetch <username>
$ git checkout <PR-branch-name>
@kamilogorek
kamilogorek / quicksort.js
Last active August 29, 2015 14:02
Quicksort on 1.000.000 random elements within 0 – 1.000.000 range
/**
* Quicksort implementation by Nicholas C. Zakas
* http://www.nczonline.net/blog/2012/11/27/computer-science-in-javascript-quicksort/
*/
var items = [];
for (var i = 0; i < 1000000; i++) {
items.push(Math.round(Math.random() * 1000000));
}