Skip to content

Instantly share code, notes, and snippets.

View ppazos's full-sized avatar
🌎
All around

Pablo Pazos Gutiérrez ppazos

🌎
All around
View GitHub Profile
@ppazos
ppazos / markdown-details-collapsible.md
Created June 24, 2021 21:34 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

A collapsible section containing markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
@ppazos
ppazos / webServer.groovy
Created June 30, 2023 01:35 — forked from renatoathaydes/webServer.groovy
A simple web server written in Groovy that provides static and code-generated content
#!/usr/bin/env groovy
import org.eclipse.jetty.server.Server
import org.eclipse.jetty.servlet.*
import groovy.servlet.*
@Grab(group='org.eclipse.jetty.aggregate', module='jetty-all', version='7.6.15.v20140411')
def startJetty() {
def server = new Server(8080)
@ppazos
ppazos / CommonTagLib.groovy
Created January 21, 2024 16:29 — forked from pledbrook/CommonTagLib.groovy
Example map with enum keys
import org.grails.common.ApprovalStatus
import static org.grails.common.ApprovalStatus.*
class CommonTagLib {
static namespace = "common"
static final STATUS_TO_CSS_CLASS = [
(PENDING): "warning",
(REJECTED): "important",
(APPROVED): "success" ].asImmutable()
@ppazos
ppazos / instanceFromName.groovy
Created February 11, 2024 15:52 — forked from neelsmith/instanceFromName.groovy
groovy: get an instance of a class from its name as a string
def objectInstance = Class.forName("NAME.AS.STRING").newInstance()
@ppazos
ppazos / better-git-branch.sh
Created February 11, 2024 18:58 — forked from schacon/better-git-branch.sh
Better Git Branch output
#!/bin/bash
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
BLUE='\033[0;34m'
YELLOW='\033[0;33m'
NO_COLOR='\033[0m'
@ppazos
ppazos / electron-builder.json
Created February 20, 2024 03:52 — forked from thatisuday/electron-builder.json
A simple electron-builder configuration.
{
"appId": "com.thatisuday.fileio",
"productName": "Electron File IO",
"copyright": "THATISUDAY TECH PVT. LTD.",
"directories": {
"app": ".",
"output": "out",
"buildResources": "build-res"
},
"files": [
@ppazos
ppazos / sub_query.groovy
Created February 28, 2024 05:01 — forked from roalcantara/sub_query.groovy
Grails: Criteria + Subquery (DetachedCriteria)
/*
Suppose we need a query searching for all Equipments that are not being used in any ServiceOrder.
It means, given the following query:
select this_.*
from equipment this_
where this_.status == 'enabled'
and not exists (select so_.id as y0_ from service_order so_ where (so_.equipment_id=this_.id))
order by this_.serial_number asc;
@ppazos
ppazos / write_file.groovy
Created March 25, 2024 18:31 — forked from js1972/write_file.groovy
How to write content to a new file (overwrite if already existing) in Groovy.
//
// Write the mock request payload to a file for checking later...
// newWrite() is the important it to ensure you get a *new* file each time.
//
def filename = "C:\\MyScratchFolder\\soapUI projects\\Testing\\procon\\mock_po_activity_request.xml"
def file = new File(filename)
def w = file.newWriter()
w << mockRequest.requestContent
w.close()
@ppazos
ppazos / print_tree.c
Created April 27, 2024 05:31 — forked from ximik777/print_tree.c
Printing Binary Trees in Ascii
/*
Copy from: http://web.archive.org/web/20090617110918/http://www.openasthra.com/c-tidbits/printing-binary-trees-in-ascii/
Source: http://web.archive.org/web/20071224095835/http://www.openasthra.com:80/wp-content/uploads/2007/12/binary_trees1.c
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ppazos
ppazos / Number.toFixed.js
Created May 8, 2024 04:50 — forked from dfkaye/Number.toFixed.js
Updated Number().toFixed() polyfill to add-then-remove the trailing '1' in every case.
// 14 March 2019
// Updated Number().toFixed() polyfill to add-then-remove the trailing '1' in every case.
// see original at https://gist.github.com/dfkaye/e977af36e668aa134c0ce55bab5bb15f
// and at https://dfkaye.wordpress.com/2017/12/06/number-tofixed-rounding-errors-broken-but-fixable/
/*
// fixes blog post solution
;(1.005).toFixed(2) == "1.01" || (function(prototype) {
var toFixed = prototype.toFixed