Skip to content

Instantly share code, notes, and snippets.

View biapar's full-sized avatar
🙂

Biagio Paruolo biapar

🙂
View GitHub Profile
@biapar
biapar / fn_remove_accents.sql
Created April 5, 2024 13:00 — forked from jgdoncel/fn_remove_accents.sql
MySQL Function to remove accents and special characters
DROP FUNCTION IF EXISTS fn_remove_accents;
DELIMITER |
CREATE FUNCTION fn_remove_accents( textvalue VARCHAR(10000) ) RETURNS VARCHAR(10000)
BEGIN
SET @textvalue = textvalue COLLATE utf8_general_ci;;
-- ACCENTS
SET @withaccents = 'ŠšŽžÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝŸÞàáâãäåæçèéêëìíîïñòóôõöøùúûüýÿþƒ';
@biapar
biapar / FileUploadApiController.cs
Created April 3, 2024 15:46 — forked from robgha01/FileUploadApiController.cs
Using AngularJS API service and Umbraco API controller to permit users to upload files to the server
// Use whatever namespacing works for your project.
namespace YourSite.Web.Controllers.Api
{
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
@biapar
biapar / countries.json
Created December 4, 2022 16:31 — forked from keeguon/countries.json
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
@biapar
biapar / proxmox-import-disk-image.txt
Created November 7, 2022 19:31 — forked from swuecho/proxmox-import-disk-image.txt
Add import existing disk image into Proxmox
#
# The official PVE docs on how to prepare cloud-init templates:
# https://pve.proxmox.com/wiki/Cloud-Init_Support#_preparing_cloud_init_templates
#
# Additional guides and resources:
# https://dae.me/blog/2340/how-to-add-an-existing-virtual-disk-to-proxmox/
# https://pve.proxmox.com/pve-docs/qm.1.html
# use the Qemu/KVM Virtual Machine Manager to import the disk
qm importdisk 107 Univention-App-kopano-core-KVM.qcow2 local-lvm
@biapar
biapar / gist:dbcc9e4cb213ece45ebe0eaf286c848f
Created March 22, 2022 16:57
NGINX Reverse Proxy configuration for Directus CMS
FOLLOWING this GUIDE https://blog.yeetpc.com/how-to-set-up-an-nginx-reverse-proxy-with-ssl-on-ubuntu-server-20-04-lts/,
I adapt the config to use with DIrectus.
Directus panel on http://ip:8055/
CONFIG FILE FOR NGINX
server {
if ($host = api.domain.xyz) {
return 301 https://$host$request_uri;
} # managed by Certbot
@biapar
biapar / ApiLessController.cs
Last active September 22, 2022 13:08
Piranha CMS: example of a simple controller to GET data in JSON format for headless use.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Piranha;
using Piranha.AspNetCore.Services;
using Piranha.Models;
using PiranhaCMS.Models;
using Microsoft.AspNetCore.Authorization;
@biapar
biapar / JsonController.cs
Created September 15, 2020 06:44 — forked from icavalheiro/JsonController.cs
Umbraco Json controller based on the ContentType renderer. Use this to return the content as a json instead of a view (great for headless mode)
using Newtonsoft.Json;
using System;
using System.Net;
using System.Web;
using System.Web.Mvc;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Web.Models;
using Umbraco.Web.Mvc;
@biapar
biapar / examples.md
Created September 9, 2020 13:54 — forked from ErisDS/examples.md
Ghost Filter Query examples

Filter Queries - Example Use Cases

Here are a few example use cases, these use cases combine filter with other parameters to make useful API queries. The syntax for any of this may change between now, implementation, and release - they're meant as illustrative examples :)

Fetch 3 posts with tags which match 'photo' or 'video' and aren't the post with id 5.

api.posts.browse({filter: "tags:[photo, video] + id:-5", limit="3"});

GET /api/posts?filter=tags%3A%5Bphoto%2Cvideo%5D%2Bid%3A-5&limit=3

@biapar
biapar / examples.md
Created September 9, 2020 13:54 — forked from ErisDS/examples.md
Ghost Filter Query examples

Filter Queries - Example Use Cases

Here are a few example use cases, these use cases combine filter with other parameters to make useful API queries. The syntax for any of this may change between now, implementation, and release - they're meant as illustrative examples :)

Fetch 3 posts with tags which match 'photo' or 'video' and aren't the post with id 5.

api.posts.browse({filter: "tags:[photo, video] + id:-5", limit="3"});

GET /api/posts?filter=tags%3A%5Bphoto%2Cvideo%5D%2Bid%3A-5&limit=3

@biapar
biapar / gist:9eaf8c2359ea47a77345987f8d489357
Created May 28, 2020 08:13
SQL Server Data Types and Their .NET Framework Equivalents
SQL Server data type CLR data type (SQL Server) CLR data type (.NET Framework)
varbinary SqlBytes, SqlBinary Byte[]
binary SqlBytes, SqlBinary Byte[]
varbinary(1), binary(1) SqlBytes, SqlBinary byte, Byte[]
image None None
varchar None None
char None None
nvarchar(1), nchar(1) SqlChars, SqlString Char, String, Char[]
nvarchar SqlChars, SqlString String, Char[]