Skip to content

Instantly share code, notes, and snippets.

View luizcarraro's full-sized avatar
🏠
Working from home

Luiz Carraro luizcarraro

🏠
Working from home
  • Pato Branco - BR
View GitHub Profile
@luizcarraro
luizcarraro / android-cordova-build.sh
Last active June 28, 2017 11:58
Android build with cordova
#!/bin/bash
# $1 = staging, production or development
BUILDPATH=cordova/platforms/android/build/outputs/apk/
echo -e '\033[01;32m >>>>>>>>>>>>>>>>>>>>>>>> ETAPA 1/4 > APLICANDO CONFIGURAÇÕES ANDROID AO PROJETO \033[00;37m'
sed -i '' 's/ios/material/g' ember-cli-build.js
echo -e '\033[01;32m >>>>>>>>>>>>>>>>>>>>>>>> ETAPA 2/4 > FAZENDO BUILD PARA ANDROID \033[00;37m'
ember cordova:build --environment=$1 --platform=android
@luizcarraro
luizcarraro / ios-cordova-build.sh
Created June 19, 2017 12:08
iOS build with cordova
#!/bin/bash
# param of enviroment: staging, production and development
# IMPORTANT: change __Project__ for your project name
echo -e '\033[01;32m >>>>>>>>>>>>>>>>>>>>>>>> ETAPA 1/3 > APLICANDO CONFIGURAÇÕES IOS AO PROJETO \033[00;37m'
sed -i '' 's/material/ios/g' ember-cli-build.js
echo -e '\033[01;32m >>>>>>>>>>>>>>>>>>>>>>>> ETAPA 2/3 > FAZENDO BUILD PARA IOS \033[00;37m'
ember cordova:build --environment=$1 --platform=ios
@luizcarraro
luizcarraro / framework7.js
Created June 19, 2017 12:06
Framework7 Ember initializer
import Ember from 'ember';
export function initialize(container) {
return Ember.run.schedule('afterRender', function () {
new Framework7();
});
}
export default {
name: 'framework7',
@luizcarraro
luizcarraro / filter for ember list.js
Created June 9, 2017 13:05
An example of filter for ember arrays
filterContacts(filter) {
var list = this.get('list');
return list.filter(function (item) {
if(_match(item.name) || _match(item.professionalEmail) || _match(item.jobFunction) || _match(item.department) || _match(item.professionalPhone)) {
return true;
} else {
return false;
}
});
@luizcarraro
luizcarraro / modal-route.js
Created March 16, 2017 14:13
Boostrap modal Ember Mixin
import Ember from 'ember';
export default Ember.Mixin.create({
activate() {
this._super();
Ember.run.next(() => {
$(".modal").modal('show');
});
},
@luizcarraro
luizcarraro / bootstrap.test.js
Created January 16, 2017 11:59
Sails Bootstrap tests
var Sails = require('sails'),
_ = require('lodash');
global.DOMAIN = 'http://localhost';
global.PORT = 1337;
global.HOST = DOMAIN + ':' + PORT;
before(function(callback) {
this.timeout(50000);
@luizcarraro
luizcarraro / beforeCreate.js
Created January 11, 2017 13:05 — forked from mphasize/beforeCreate.js
Sails-beforeCreate-Policy
/**
* beforeCreate
*
* @module :: Policy
* @description :: Simple policy to inject the user creating a record into the records values.
* Assumes req.user && req.user.id to be set when a user is logged in.
* @docs :: http://sailsjs.org/#!documentation/policies
*
*/
@luizcarraro
luizcarraro / ajax.js
Created December 12, 2016 15:42
Configuração de Ajax no EmberJS com Token JWT nos Headers
import Ember from 'ember';
import AjaxService from 'ember-ajax/services/ajax';
import environment from 'web/config/environment';
export default AjaxService.extend({
host: environment.apiBaseUrl,
session: Ember.inject.service(),
headers: Ember.computed('session.session.content.authenticated.token', {
get() {
let headers = {};
@luizcarraro
luizcarraro / fix-ubuntu-watchman
Created December 5, 2016 11:38
Makes ubunto accept many watchman processes
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
@luizcarraro
luizcarraro / header-controller.js
Created August 19, 2016 14:17
Collapse Bootstrap Navbar on Ember or Any Single page application
import Ember from 'ember';
export default Ember.Component.extend({
didRender() {
Ember.$('.nav li a').on('click', function(clicked) {
if (!Ember.$(this).hasClass("dropdown-toggle")) {
Ember.$('.navbar-collapse').collapse('hide');
}
});
}