Skip to content

Instantly share code, notes, and snippets.

@ayamflow
ayamflow / gist:8690726
Last active August 29, 2015 13:55
Handy Git commands

Handy Git commands

  • Show list of commits with hash: git log
  • Show file at revision: git show REVISION:path/to/file
  • Roll back to revision: git reset --hard REVISION
  • Revert a file to revision: git checkout REVISION path/to/file
  • Get my colleague's file version during a merge: git checkout --theirs path/to/file
  • Add a remote : git remote add origin https://github.com/user/repo.git
  • Force unstash : git stash show -p | git apply && git stash drop

#Angular.js / Vue.js similarities & differences

##Similar stuff

  • Same transtion API (enter/leave)
  • Filters
  • Two-way data-binding
  • Nested scope inheritance
  • Modules:
@ayamflow
ayamflow / gist:8952492
Last active August 29, 2015 13:56
Sublime Text 2 Dropbox Sync

1. Create a folder into your dropbox directory

mkdir ~/Dropbox/Sublime\ Text\ 2

2. Go to Sublime Text 2 directory

cd ~/Library/Application\ Support/Sublime\ Text\ 2/

3. Move configuration to dropbox

mv ./Packages ~/Dropbox/Sublime\ Text\ 2/Packages mv ./Installed\ Packages ~/Dropbox/Sublime\ Text\ 2/Installed\ Packages mv ./Pristine\ Packages ~/Dropbox/Sublime\ Text\ 2/Pristine\ Packages

@ayamflow
ayamflow / gist:387d19a0ae658f0de8b6
Last active August 29, 2015 14:01
bindAll standalone from underscore
module.exports = function(obj) {
var funcs = Array.prototype.slice.call(arguments, 1);
if (funcs.length === 0) throw new Error('bindAll must be passed function names');
funcs.forEach(function(f) {
obj[f] = obj[f].bind(obj);
});
return obj;
};

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"

npm adduser

@ayamflow
ayamflow / gist:b4e3261a0a18526cad88
Created July 13, 2014 11:12
Sublime Text-like tab bar for Atom Editor
// Custom styles - ayamflow
.tab-bar {
height: 33px !important;
line-height: 33px !important;
background-image: -webkit-linear-gradient(#2b2b2b, #353535) !important;
&:active {
background-color: #424242;
border-top: 1px solid #2E2E2E;
@ayamflow
ayamflow / dom.js
Created August 4, 2014 14:58 — forked from rayfranco/dom.js
Vue.directive('dom', {
isLiteral: true,
bind: function () {
this.vm.$.dom = this.vm.$.dom || {};
this.vm.$.dom[this.expression] = this.el;
},
unbind: function () {
delete this.vm.$.dom[this.expression];
}
});
img.grayscale.disabled {
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'1 0 0 0 0, 0 1 0 0 0, 0 0 1 0 0, 0 0 0 1 0\'/></filter></svg>#grayscale");
-webkit-filter: grayscale(0%);
}
@ayamflow
ayamflow / gist:ee453481d31713d0b10c
Created August 14, 2014 09:40
Angular $watch tricks

#Angular.js $watch tricks

###Angular enables you to $watch anything:

  • $scope.foo
$scope.$watch('foo', cb);
@ayamflow
ayamflow / Code Physics cheat sheet
Last active August 29, 2015 14:07
Code Physics cheat sheet
Code physics cheat sheet
===
- velocity = variation of position over time
- acceleration = variation of velocity over time
- friction = opposite of velocity. Fast friction: using a scalar instead of using an opposite vector. (i.e. velocity * 0.9)
Velocity with spring & friction (AKA elastic ease)