Skip to content

Instantly share code, notes, and snippets.

View victorjspinto's full-sized avatar

Victor Jose Silva Pinto victorjspinto

  • Rio de Janeiro, RJ
View GitHub Profile
@victorjspinto
victorjspinto / gist:6217210
Created August 13, 2013 02:09
Evita problemas de $scope.$apply
var phase = scope.$root.$$phase;
if(phase == '$apply' || phase == '$digest') {
ngModel.$setViewValue(editor.getSession().getValue());
} else {
scope.$apply(function(){
ngModel.$setViewValue(editor.getSession().getValue());
});
}
(function(){
$("#button1").click(onClickButton1);
$("#button2").click(onClickButton2);
var time
function onClickButton1(){
time = Date.now()
console.log(time)
@victorjspinto
victorjspinto / new_gist_file
Created September 6, 2013 22:22
Aplicar classes com AngularJS
data-ng-class="{investor:'btn-entrar-investor', startup:'btn-entrar-startup', 'professional':'btn-entrar-professional'}[page.entity]"
data-ng-class="[page.btn_entrar]"
data-ng-class="{selected: $index==selectedIndex}"
data-ng-class="{$index==selectedIndex} ? 'selected' : ''"
@victorjspinto
victorjspinto / gist:6782881
Created October 1, 2013 18:28
Como aplicar classes via expressões AngularJS
ng-class="{'block-value' : gasto.valor > valorDiario}"
// wait until after $apply
$timeout(function(){
console.log(scope.yourDirective);
});
┌───┐
│ 3 │┌───┬───┐
├───┤│ 3 │ 3 │
│ 2 │└───┴───┘
└───┘
╔═══╗
║ 3 ║╔═══╦═══╗
╠═══╣║ 3 ║ 2 ║
║ 3 ║╚═══╩═══╝
╚═══╝
@victorjspinto
victorjspinto / installer.sh
Last active April 11, 2017 18:03
Install all dev dependencies on Ubuntu 12.10
## adicionar deb http://security.ubuntu.com/ubuntu trusty-security main
# /etc/rc.local (Monta HD automático)
# mkdir -p /media/OS
# mount /dev/sda5 /media/OS &
# exit 0
sudo apt-get update
sudo apt-get -y upgrade
@victorjspinto
victorjspinto / pom.xml
Last active August 29, 2015 14:13
maven-java-parent
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.lordviktor</groupId>
<artifactId>java-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
@victorjspinto
victorjspinto / .gitmodules
Last active August 29, 2015 14:13
maven-java-web-parent
[submodule "java-parent"]
path = java-parent
url = git@gist.github.com:/bb301f403bbe939170a9.git
@victorjspinto
victorjspinto / gist:1a13317aaae23fd32d06
Created May 21, 2015 18:15
Write git hash revision on file with grunt
grunt.registerTask('tag-revision', 'Tag the current build revision', function () {
grunt.task.requires('git-describe');
grunt.file.write('public/version.json', JSON.stringify({
version: grunt.config('pkg.version'),
revision: grunt.config('meta.revision'),
date: grunt.template.today()
}));
});