This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const moment = require('moment') | |
moment.locale('pt-BR') | |
let now = moment() | |
let hour = Number(now.format('HH')) | |
now.set({'hour': 21, 'minute': 0, 'second': 0, 'millisecond': 0}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.Normalizer; | |
public class ExemploSubstring { | |
public static void main(String[] args) { | |
String str = "Caiô sérgio evidência saída"; | |
str = Normalizer.normalize(str, Normalizer.Form.NFD); | |
str = str.replaceAll("[^\\p{ASCII}]", ""); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ExFormatationDate { | |
public static void main(String[] args) { | |
String dt1 = "20200124"; | |
StringBuilder sb = new StringBuilder(dt1) | |
.insert(4,"-") | |
.insert(7,"-"); | |
String output = sb.toString(); | |
System.out.println(output); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const Model = require('model') | |
const mongoose = require('mongoose') | |
const log = require('ololog').noLocate | |
mongoose.connect( | |
'mongodb://localhost/mydb', | |
{ useNewUrlParser: true, useCreateIndex: true }, | |
function (err) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const knex = require('../database') | |
module.exports = { | |
update: async list => { | |
list.forEach(element => { | |
if (element['data'] !== undefined) { | |
let params = element.data | |
return knex('tb_name') | |
.transacting(params) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Members::Create | |
attr_accessor :member | |
def self.create(member_params,user_params, session) | |
account = Account.find(session[:account_id]) | |
user = User.new(user_params) | |
user.password = user.password_confirmation = '123456' |