Skip to content

Instantly share code, notes, and snippets.

//observable_get
@Bindable
#if($field.modifierStatic)
static ##
#end
$field.type ##
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
#if ($field.boolean && $field.primitive)
is##
#else
func frequency(numbers: [Int]) -> [Int: Int] {
var frequencyDictionary: [Int:Int] = [:]
for number in numbers {
if let existentValue = frequencyDictionary[number] {
frequencyDictionary[number] = existentValue + 1
} else {
frequencyDictionary[number] = 1
}
}
return frequencyDictionary
import Foundation
func remove(input: String, first: Int, last: Int) -> String {
// we require a variable to manipulate strings
let newString = input
// modify newString and return the result
let firstIndex = newString.index(newString.startIndex, offsetBy: first)
let lastIndex = newString.index(newString.endIndex, offsetBy: (last * -1))
# Autocomplete
if [ -f /usr/local/git/contrib/completion/git-completion.bash ]; then
. /usr/local/git/contrib/completion/git-completion.bash
fi
# mostra se existem alterações no projeto (master/branch)
GIT_PS1_SHOWDIRTYSTATE=true
# necessário para o correto funcionamento da variável ‘__git_ps1’
source /usr/local/git/contrib/completion/git-prompt.sh
allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xmaxerrs" << "5000"
}
}
}
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
# write your script here
#!/bin/bash
set -eu
ext {
localProp = new Properties()
fileName = 'local.properties'
if (project.rootProject.file(fileName).exists()) {
localProp.load(new FileInputStream(rootProject.file(fileName)))
}
groupName = "br.com.cetelem.android.components"
publishUsername = System.env.PUBLISH_USERNAME != null ? System.env.PUBLISH_USERNAME : localProp["publishUsername"] ?: ""
publishPassword = System.env.PUBLISH_PASSWORD != null ? System.env.PUBLISH_PASSWORD : localProp["publishPassword"] ?: ""
repoUrl = System.env.REPO_URL != null ? System.env.REPO_URL : localProp["repoUrl"] ?: ""
void main() {
Pessoa p = Pessoa("Hernand");
int a = 3;
int b = 2;
Calculadora calc = Calculadora();
int c = Calculadora.soma(a, b);
print("Soma: $c");
print("Soma: ${p.nome}");
}
void main() {
Carro c1 = Carro("Fusca");
Carro c2 = Carro("Brasilia");
Carro c3 = Carro("Chevete");
//List<Carro> carros = List<Carro>();
//carros.add(c1);
//carros.add(c2);
//carros.add(c3);
var carros = [c1, c2, c3];
void main() {
Carro c1 = Carro("Fusca");
Carro c2 = Carro("Brasilia");
Carro c3 = Carro("Chevete");
final carros = {1:c1 ,2: c2};
carros[3] = c3;
print ("Lista $carros");