Skip to content

Instantly share code, notes, and snippets.

View uhtred's full-sized avatar

Daniel França uhtred

View GitHub Profile
@uhtred
uhtred / awesomplete.js
Created October 5, 2015 02:57
Awesomplete directive
(function(angular) {
'use strict';
var app = angular.module('test', []);
app.directive('awesomplete', function() {
function link(scope, element, attrs){
console.log(attrs);
var elm = element[0];
@uhtred
uhtred / reject-by-values.mixin.lodash.js
Created October 5, 2015 02:55
Reject By Values - lodash
_.mixin({
'rejectByValues': function(collection, property, values) {
return _.filter(collection, function(item) {
return !_.contains(values, item[property]);
});
}
});
@uhtred
uhtred / sample.controller.js
Created October 1, 2015 20:40
Controller Sample #1
(function () {
'use strict';
function ProfileEditController($scope, $injector, profile, $state) {
var vm = this,
profileService = $injector.get('ProfileService'),
$stateParams = $injector.get('$stateParams'),
$modal = $injector.get('$modal'),
$defaultCrudModal = $injector.get('$defaultCrudModal');
@uhtred
uhtred / filter.test.protractor.js
Created September 30, 2015 14:23
Test Angular Filter Protractor
this.list = element.all(by.repeater('item in items')).filter(function(elem) {
return elem.isDisplayed();
});
@uhtred
uhtred / git-branch-dirty.sh
Created September 22, 2015 19:08
Show git branch and dirty
export PS1='\[\033[1;34m\]\!\[\033[0m\] \[\033[1;35m\]\u\[\033[0m\]:\[\033[1;35m\]\W\[\033[0m\] \[\033[1;92m\]$(__git_ps1 "(%s)")\[\033[0m\]\$ '
export GIT_PS1_SHOWDIRTYSTATE=1
@uhtred
uhtred / watch-limit.sh
Last active September 23, 2015 13:16
Watch limit for gulp and grunt
sudo echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
@uhtred
uhtred / SublimeText config.json
Created September 11, 2015 22:07
SublimeText config
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
"font_face": "Hack",
"font_size": 9,
"highlight_modified_tabs": true,
"ignored_packages":
[
"Vintage"
@uhtred
uhtred / fn.js
Created August 25, 2015 12:35
Axiliar Functions JS
// @use: fn.fqn(obj, 'result.message', '')
var fn = {
fqn: function(obj, path, fallback) {
fallback = typeof fallback === 'undefined' ? {} : fallback;
try {
return eval('obj.' + path);
} catch(e) {
return fallback;
}
}
@uhtred
uhtred / nunjucks-macros.tpl
Last active May 28, 2016 07:43
Nunjucks Macros
{% macro input(name, value, type='text', class="") %}
<input type={{ type }} name={{ name }} value={{ value }} class="{{ class }}" />
{% endmacro %}
{% macro select(name='', id='', class='', options='', first='Selecione' ) %}
<select name="{{name}}" id="" {{ class }}>
{% if first %}
<option value="">{{first}}</option>
{% endif %}
{% for option in options %}
@uhtred
uhtred / grunt-swig-json.js
Last active August 29, 2015 14:26
Grunt Swig JSON Integration
/*
* grunt-swig
*
*
* Copyright (c) 2015 Daniel França
* Licensed under the MIT license.
* My First Grunt Plugin
*/
'use strict';