Skip to content

Instantly share code, notes, and snippets.

@afmicc
afmicc / datatable-render-customNumberFormat.js
Created September 21, 2018 00:59
Render function to numeric column type for datatables.net - Parameters: "," decimal separator and "." thousand separator.
// usage
$("#dataTable").DataTable(
{
"columns": [
{
"data": "precio",
"name": "Precio",
"render": $.fn.dataTable.render.customNumberFormat('.', ',', 6)
}
@afmicc
afmicc / datatable-render-customNumberFormat.js
Created September 21, 2018 01:07
Render function to numeric column type for datatables.net
// usage
$("#dataTable").DataTable(
{
"columns": [
{
"data": "precio",
"name": "Precio",
"render": $.fn.dataTable.render.customNumberFormat('.', ',', 6)
}
@afmicc
afmicc / CleanProject.PS1
Created September 21, 2018 01:46
This script delete all bin, obj, node_modules, and packages folders from a solution.
Get-ChildItem .\ -include bin,obj,node_modules,packages -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }
@afmicc
afmicc / sort-array.js
Created September 21, 2018 01:54
Sort array by properties
/*
* property: sort by property (name) - type: string
* property2: then sort by property2 (name) - type: string - optional
* areNumbers: Are property and property2 numbers? - type: boolean - optional
*/
Array.prototype.sortBy = function(property, property2, areNumbers)
{
return this.sort(function(a,b)
{
var valueA = areNumbers ? 0 : "";
@afmicc
afmicc / !README.md
Last active January 21, 2020 20:19
DataTable.net - Implementation of serverside processing in .net Core MVC with ef core dynamic query to paging, sorting and searching

DataTable.net - serverside processing

DataTable.net - Implementation of serverside processing in .net Core MVC with ef core dynamic query to paging, sorting and searching

@afmicc
afmicc / area-list.component.ts
Last active September 27, 2018 20:59
Convert json response to object in typescript
import { CopyHelper } from '../../helpers/copy.helper';
import { Area } from '../../models/area';
export class AreaListComponent
{
...
getAreas(): void
{
this.service.getAll()
.subscribe(response =>
@afmicc
afmicc / IdentificationValidator.cs
Last active December 17, 2018 14:21
Verificador de cedula de identidad (CI) uruguaya. Angular validator.
namespace Helpers
{
#region --- Usings ---
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#endregion
@afmicc
afmicc / !README.md
Last active October 20, 2019 02:36
VS Code debug Ruby on Rails

VS Code debug Ruby on Rails

Steps

  1. In a terminal: run rails debug
  2. In VS Code: Debug > select Listen for rdebug-ide > Play
@afmicc
afmicc / heroku_copy_database.sh
Created September 27, 2019 13:48
Heroku - Copy database to another app
# get git remote url names
git remote -v
# create back up at old app
heroku pg:backups:capture --remote origin-remote-name-url
heroku pg:backups:download --remote origin-remote-name-url # optional
# get backup url
heroku pg:backups:url --remote origin-remote-name-url # return s3-amazon-url
@afmicc
afmicc / ruby-on-rails-intallation.md
Last active October 20, 2019 02:41
Installing ruby on rails on windows from Ubuntu bash

Ruby on Rails installation

Installing ruby on rails on windows from Ubuntu bash

  1. (Optional) Install PogreSQL

  2. Install ruby + rails

  3. If you install rails 6+, you need to install yarn.