Skip to content

Instantly share code, notes, and snippets.

View renatocantarino's full-sized avatar

Renato Cantarino renatocantarino

View GitHub Profile
@renatocantarino
renatocantarino / gist:8557823
Created January 22, 2014 12:21
Executar aptana Ubuntu
sudo -u root /opt/Aptana_Studio_3/AptanaStudio3
@renatocantarino
renatocantarino / Node01
Created March 9, 2014 21:41
Codigo NodeJS
//carrega a lib Http do Node
var http = require('http');
//Cria um serviço web para tratar requisicao
var _server = http.createServer(function(request,response)
{
//parametros do cabeçalho
response.writeHead(200,{'Content-Type': 'text/html'});
@renatocantarino
renatocantarino / gist:9511376
Created March 12, 2014 17:02
readFile nonBlock
var fs = require('fs');
var contents =
fs.readFile('index.html' , function(err, ctt)
{
console.log(ctt);
var MailListener = require("mail-listener2");
var Cylon = require("cylon");
var mailListener = new MailListener({
username: "[email protected]", //seu email
password: "", //sua senha
host: "imap.gmail.com",
port: 993,
tls: true,
tlsOptions: { rejectUnauthorized: false },
@renatocantarino
renatocantarino / app.js
Created May 6, 2014 01:35
Controller Angular
var mvcApp = angular.module('diretivasAng', []);
mvcApp.controller('dirController', function dirController($scope) {
$scope.frutas = [
{name:'Maça'},
{name:'Uva'},
{name:'Jaca'}
];
<!DOCTYPE html>
<!-- diretiva ng-app -->
<html ng-app="diretivasAng">
<head>
<meta charset="utf-8" />
<title> Diretivas</title>
<script>
document.write('<base href="' + document.location + '" />');
@renatocantarino
renatocantarino / gist:5783ae4033882893ad50
Last active August 29, 2015 14:02
HTML angularJS controller
<!DOCTYPE html>
<html ng-app>
<head>
<title>TRABALHANDO COM CONTROLLERS</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<script type="text/javascript" src="contatos.js"> </script>
</head>
<body>
@renatocantarino
renatocantarino / gist:4a2fbe9c6d7d23810ec8
Created June 1, 2014 01:02
JS controller AngularJS
function ContatoController($scope) {
$scope.contatos = ["renato", "astrogildo"];
$scope.adicionar = function() {
$scope.contatos.push($scope.novo);
$scope.novo = "";
}
}
<html ng-app='AngularIntro'>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
</head>
<body ng-controller='SimpleController'>
<input type='text' ng-model='name'>
<input type='button' value='Adicionar' ng-click='addName()'>
<table>
<!DOCTYPE html>
<html ng-app="app">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<script type="text/javascript">
app = angular.module("app", []);
app.controller('MainCtrl', function($scope, config) {
$scope.config = config;