Skip to content

Instantly share code, notes, and snippets.

View kleberksms's full-sized avatar

Kleber Syd Moraes da Silva kleberksms

View GitHub Profile
const generateRandomFloatInRange = (min, max) => {
return (Math.random() * (max - min + 1)) + min;
};
let obj = {
compras:[
{
produtos:[
{
valor_unitario:generateRandomFloatInRange(0,2)
const MAX_LENGHT_FILE = 7;
const MAX_UPLOAD_SIZE = 5000000;
const temporaryFileList = [];
const dangerToast = (text) => {
console.error(text);
};
const maxLenghtFilesIsValid = (files = []) => {
if (!Array.isArray(files)) {
export class Inflector {
static pluralize(word: string): string {
if (!word) {
return;
}
const isPluralAlready = word.endsWith('ies') || word.endsWith('es') || (!word.endsWith('us') && word.endsWith('s'));
if (isPluralAlready) {
return word;
}
if (word.endsWith('y') && !word.endsWith('ay')) {
Container(
child: Table(
border: TableBorder(
left: BorderSide(
width: 1,
color: Color(0xFFB1B1B1),
style: BorderStyle.solid,
),
right: BorderSide(
width: 1,
Container(
child: Table(
border: TableBorder(
left: BorderSide(
width: 1,
color: Color(0xFFB1B1B1),
style: BorderStyle.solid,
),
right: BorderSide(
width: 1,
Material(
elevation: 15,
shadowColor: Colors.black54,
child: Column(
children: <Widget>[
Container(
decoration: BoxDecoration(color: Colors.white),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
const general = this.scheduleService.getQueryCollection(ref => ref
.where('patientId', '==', uid)
.orderBy('date', 'asc'));
const appointments = this.scheduleService.getQueryCollection(ref => ref
.where('patients', 'array-contains', uid)
.orderBy('date', 'asc'));
combineLatest([general, appointments]).pipe(
map(arr => arr.reduce((acc, cur) => acc.concat(cur))),
@kleberksms
kleberksms / else.java
Created March 13, 2019 17:24
Rule 2: Don’t use the ELSE keyword
if (status == DONE)
{
doSomething();
}
else
{
...
}
@kleberksms
kleberksms / board-after.java
Created March 13, 2019 17:21
One level of indentation per method
class Board
{
...
String board()
{
StringBuffer buf = new StringBuffer();
collectRows(buf);
return buf.toString();
}
@kleberksms
kleberksms / board-before.java
Last active March 13, 2019 17:20
One level of indentation per method
class Board
{
...
String board()
{
StringBuffer buf = new StringBuffer();
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)