Skip to content

Instantly share code, notes, and snippets.

View ramiresnas's full-sized avatar

Ramires Moreira ramiresnas

View GitHub Profile
@ramiresnas
ramiresnas / .java
Created August 4, 2017 01:04
A question about array
import java.util.ArrayList;
import java.util.List;
public class Question {
@SuppressWarnings({ "rawtypes", "unchecked" })
public static void main(String[] args) {
int ind[] = { 1, 1, 2 ,2 ,2 ,3 ,3, 3, 3, 4, 4, 4};
@ramiresnas
ramiresnas / .java
Created August 4, 2017 19:55
Tipos em Java
public class Duvida {
public static void main(String[] args) {
//declarando
int numero;
//inicializando
numero = 2234589;
//poderiamos ter declarado e inicializado em uma única linha
int numero2 = 2234589;
//uma outra forma válida mas menos utilizada é:
int x=3,y=5,z=x;
@ramiresnas
ramiresnas / .java
Created August 5, 2017 16:59
Euclidean distance of all points of one matrix
import static java.lang.Math.sqrt;
import static java.lang.Math.pow;
import static java.lang.System.out;
public class {
public static void main(String[] arg) {
double[][] X = { { 9, 2 }, { 1, 4 }, { 9, 6 }, { 2, 8 } };
@ramiresnas
ramiresnas / .swift
Created September 21, 2017 16:08
Agenda de contatos
//: Playground - noun: a place where people can play
import Cocoa
//questao 1
class Contact {
var name : String
var phone : String
var email : String
@ramiresnas
ramiresnas / .js
Last active September 23, 2017 13:13
Como mostrar a view
// View.js
class View{
constructor(selector){
this.element = document.querySelector(selector)
}
template(model){
throw new Error("abstract method must be override")
}
@ramiresnas
ramiresnas / .js
Created September 28, 2017 23:50
// View.js
class View{
constructor(selector){
this.element = document.querySelector(selector)
}
//deve ser reescrito
template(model){
throw new Error("abstract method must be override")
}
@ramiresnas
ramiresnas / .swift
Created November 20, 2017 21:02
Navegação entre meses
import Foundation
class NavigationMonth{
var current = Date()
var next : Date{return Calendar.current.date(byAdding: .month, value: 1, to: current)!}
var before : Date{return Calendar.current.date(byAdding: .month, value: -1, to: current)!}
init() {} // deve possuir um inicializador em branco
init(date : Date) {
@ramiresnas
ramiresnas / .js
Created December 8, 2017 10:15
Acessando this dentro de uma função anônimo
var x = 0;
ngOnInit() {
var changeMapLocation = changeMapLocation();
let self = this
if(window.navigator.geolocation){
navigator.geolocation.getCurrentPosition(function(position) {
self.x = 10;
});
}
//declarando
int numero;
//inicializando
numero = 2234589;
//poderiamos ter declarado e inicializado em uma única linha
int numero2 = 2234589;
//uma outra forma válida mas menos utilizada é:
int x=3,y=5,z=x;
@ramiresnas
ramiresnas / .swift
Created January 25, 2018 18:30
table view com opções
//
// ConfigurationViewController.swift
// odonto
//
// Created by Ramires Moreira on 1/15/18.
// Copyright © 2018 Ramires Moreira. All rights reserved.
//
import UIKit