Skip to content

Instantly share code, notes, and snippets.

Application.Common.directive('ifRole', ["AuthService", function(AuthService) {
return {
restrict: "A",
transclude: "element",
scope: {},
compile: function(el, attrs, transclude) {
var currentUserRole = AuthService.currentUser.role;
var specifiedRole = attrs.ifRole;
return function(scope, el, attrs) {
App.factory('Search', function(Restangular) {
return Restangular.all("searches").getList();
});
@ds82
ds82 / gist:6171716
Last active December 20, 2015 17:49
var db = require('./database.js'),
tasks = {},
taskToRun = process.argv[2],
taskRunner;
tasks.makeThumbnail = require('./tasks/makeThumbnail');
tasks.uploadToS3 = require('./tasks/uploadToS3');
taskRunner = function(task){
@ds82
ds82 / gist:6719683
Last active December 24, 2015 00:49
My personal AngularJS Developing Guidelines

Angular App Guidelines

Controller

  • Controllers are named like SomeCtrl, SomeEditCtrl, etc..
  • Controllers of the same Domain are specified in the same file (unless they become to big)

Resource

  • Resources are called SomeResource and defined as a factory
@ds82
ds82 / frameworks
Created April 10, 2014 06:27
Frameworks, Libs, etc ..
### Server
| Name | Bereich | URL |
| ------------- | -------------- | ---------------------------------------------------------------------------- |
| nodejs | runtime | [http://nodejs.org/](http://nodejs.org/) |
| express | lib/framework | [http://expressjs.com/](http://expressjs.com/) |
| socket.io | lib/framework | [http://socket.io/](http://socket.io/) |
| node-ffi | lib/framework | [https://github.com/rbranson/node-ffi](https://github.com/rbranson/node-ffi) |
| gulp | build-tool | [http://gulpjs.com/](http://gulpjs.com/) |
| jasmine | unit-tests | [http://jasmine.github.io/](http://jasmine.github.io/) |
@ds82
ds82 / gist:e9aac5b9c1d1fd1955e1
Last active August 29, 2015 14:02
Alias for fast & consistent commits of git submodule's in parent repo
[alias]
csm = ! sh -c 'pushd $0 >/dev/null && REV=$(git rev-parse HEAD|cut -c1-7) && popd && git add -A $0 && git commit -m \"submodule $0 -> $REV\"'

Keybase proof

I hereby claim:

  • I am ds82 on github.
  • I am ds82 (https://keybase.io/ds82) on keybase.
  • I have a public key whose fingerprint is B0EC 363A 0C93 7FA7 0767 37E8 E038 A35D 1D8C 3AD6

To claim this, I am signing this object:

@ds82
ds82 / gist:72ef893136b102df502d
Created April 9, 2015 05:49
Remove old/unused linux kernels in debian/ubuntu
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
@ds82
ds82 / gerrit-add-changeId
Created June 24, 2015 08:54
gerrit change-id hinzufügen (OSX/zsh)
tmp=$(mktemp /tmp/commit-msg.XXXX)
hook=$(stat -f $(git rev-parse --git-dir))/hooks/commit-msg
git filter-branch -f --msg-filter "cat > $tmp; \"$hook\" $tmp; cat $tmp" START..END
@ds82
ds82 / .gitconfig.user
Last active November 5, 2015 09:37
some of my git aliases
branch-start = "!f() { git log $1 --reverse --ancestry-path $(git merge-base $1 HEAD)..HEAD --pretty=%H | head -n1; }; f"
branch-end = "!f() { git log $1 --ancestry-path $(git merge-base $1 HEAD)..HEAD --pretty=%H | head -n1; }; f"
merge-commit = "!f() { FROM=$(git branch-start $1 | cut -c1-6); TO=$(git branch-end $1 | cut -c1-6); git merge --ff-only $1; git commit --allow-empty -m \"merge ${1} ${FROM}..${TO}\"; }; f"
## csm = commit submodule with changes
csm = "!f() { git reset $1; HEAD=$(git diff --ignore-submodules=dirty --submodule=log $1 | head -n1 | sed -e 's/^Submodule //g' -e 's/:$//g'); TAIL=$(git diff --ignore-submodules=dirty --submodule=log $1 | tail -n +2 | sed -e 's/$/ /g'); git add -A $1 && git commit -m \"${HEAD}\" -m \"${TAIL}\"; }; f"
branch-name = "!git rev-parse --abbrev-ref HEAD"
last-branch-name = "!f() { echo $(git rev-parse --symbolic-full-name @{-1} | sed -e 's/refs\\/heads\\///' ); }; f"