Skip to content

Instantly share code, notes, and snippets.

View deyvicode's full-sized avatar

Deyvi De La Cruz deyvicode

View GitHub Profile
@deyvicode
deyvicode / filesinfolder.bas
Created September 7, 2022 22:01
VBA read files in folder
Sub LoopThroughFiles()
Debug.Print ""
Debug.Print "-------------------------------------------------"
Dim oFSO As Object
Dim oFolder As Object
Dim oFile As Object
Dim i As Integer
@deyvicode
deyvicode / no_transmisibles_21.bas
Last active September 8, 2022 16:31
CONSOLIDATORS
Sub consolidate()
Dim Destiny As Workbook
Set Destiny = ThisWorkbook
Dim Data As Workbook
Dim Path As String
Dim mrs As Variant
mrs = Array( _
@deyvicode
deyvicode / excel-spliter.bas
Last active February 27, 2022 13:17
Excel Splitter
Sub Test()
'declarar variables
Dim wb As Workbook
Dim ThisSheet As Worksheet
Dim NumOfColumns As Integer
Dim RangeToCopy As Range
Dim RangeOfHeader As Range
Dim WorkbookCounter As Integer
Dim RowsInFile
@deyvicode
deyvicode / searchbycolumn.bas
Last active February 27, 2022 13:18
Codigo para input busqueda por columna en Excel habilitado para macros
Private Sub BoxSearch_Change()
Dim text As String
If Sheet1.BoxSearch.value <> "" Then
text = "*" & Sheet1.BoxSearch.value & "*"
Range("A3").CurrentRegion.AutoFilter Field:=3, Criteria1:=text
Else
text = ""
Range("A3").CurrentRegion.AutoFilter
End If
End Sub
@deyvicode
deyvicode / getdate.js
Created January 8, 2022 13:15
Formatear fechas con traducciones en JavaScript.
const format = (date, locale, options) => new Intl.DateTimeFormat(locale, options).format(date)
const now = new Date()
format(now, 'es') // '8/1/2022'
format(now, 'es', { dateStyle: 'long' }) // '8 de enero de 2022'
format(now, 'es', { timeStyle: 'short' }) // '8:13'
format(now, 'ko') // '2022. 1. 8.'
format(now, 'en', { weekday: 'short', day: 'numeric' }) // '5 Wed'
@deyvicode
deyvicode / exporttojson.sql
Last active January 5, 2022 03:59
Export JSON file from SQL database
SELECT JSON_ARRAYAGG(JSON_OBJECT(
'name', name,
'address', address
))
FROM mybd.mytable
INTO OUTFILE '\path\users.json';
@deyvicode
deyvicode / ainfo.md
Last active December 27, 2021 14:23
My Custom Shell Themes

Personalización del la terminal en windows con:

  • PowerShell
  • Oh-my-posh
  • Fluent Terminal

deyvi-lean-prev.jpg

@deyvicode
deyvicode / app.ts
Last active May 19, 2023 04:48
TypeScript - POO
class Course {
constructor(private _id: number, private _name: string) {}
// get and set
get id() {
return this._id
}
@deyvicode
deyvicode / datatable-ajax.js
Last active December 27, 2021 14:31
Jquery Datatable with data by ajax
$('#table').DataTable({
'processing': true,
'serverSide': true,
'destroy': true,
'ajax': {
'url': '/route',
'type': 'GET'
},
'columns': [
{ data: 'column1' },
@deyvicode
deyvicode / laravel-transaction.php
Last active December 27, 2021 14:30
Una transacción es para asegurar que todo el proceso sea completado con exito, de no ser asi se revierten los cambios al estado inicial de la transacción.
// use DB;
// use Log;
try {
DB::beginTransaction();
// code
DB::commit();
} catch (\PDOException $e) {