Skip to content

Instantly share code, notes, and snippets.

View rafaelqueiroz88's full-sized avatar
🔷
Darting

Rafael Queiroz de Castro rafaelqueiroz88

🔷
Darting
View GitHub Profile
@Kalaivanimurugan
Kalaivanimurugan / display_model_names.rb
Last active December 1, 2023 21:13
List all model names in rails console
Rails.application.eager_load!
ActiveRecord::Base.descendants # It returns all models and its attributes.
ApplicationRecord.descendants.collect(&:name) # It returns only the model names
@danilomiranda
danilomiranda / splitCSV
Created June 26, 2015 18:02
Dividir arquivo CSV em arquivos menores
String charset = "Cp1252";
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream("CAMINHO ARQUIVO ORIGEM"), charset));
String line="";
String destiny="CAMINHO ARQUIVO DESTINO";
int count = 1;
int fileSize = 0;
OutputStreamWriter fos = new OutputStreamWriter(new FileOutputStream(destiny+count+".csv"),charset);
while((line = bufferedReader.readLine()) != null) {
if(fileSize + line.getBytes().length > 50 * 1024 * 1024){