Skip to content

Instantly share code, notes, and snippets.

@number5
number5 / array_pop.sql
Created November 25, 2011 03:00
array pop function for postgresql 8.4+
CREATE OR REPLACE FUNCTION array_pop(a anyarray, element character varying)
RETURNS anyarray
LANGUAGE plpgsql
AS $function$
DECLARE
result a%TYPE;
BEGIN
SELECT ARRAY(
SELECT b.e FROM (SELECT unnest(a)) AS b(e) WHERE b.e <> element) INTO result;
RETURN result;
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
@TeddyGandon
TeddyGandon / _bga_ide_helper.php
Last active July 7, 2020 00:43
This an IDE helper for developing games on Board Game Arena Studio. Feel free to use it in your preferred IDE to get out these ugly undefined methods errors and to have a direct documentation to classes / methods.
<?php
/**
* This an IDE helper for developing games on Board Game Arena Studio.
* Feel free to use it in your preferred IDE to get out these ugly undefined methods errors and to have a direct
* documentation to classes / methods.
*
* @author Teddy Gandon
* @see https://gist.github.com/TeddyGandon/9e3183475252203b1ede192688b463cd
*/
@cmizzi
cmizzi / .zshrc
Last active January 29, 2019 13:51
Add `dockershell` command to get logged in container (service or container)
dockershell() {
if [ "$1" = "service" ]; then
ID=$(docker inspect --format '{{.Status.ContainerStatus.ContainerID}}' $(docker service ps -q "$2" | head -1))
else
ID=$2
fi;
docker exec -t -i -e PS1="$ID:\w# " "$ID" bash --noprofile --norc
}
@sonovice
sonovice / 50-razer-pro-type-ultra.hwdb
Created September 9, 2022 18:02
Invert FN Function Keys (except F11 and F12) for Razer Pro Type Ultra
# Razer Pro Type Ultra Keyboard
# Hardware Database file that switches the media keys and F1-F10
# (F11 and F12 keypress events are not propagated through USB without the FN key)
#
# Instructions:
# save the content of this file to "/etc/udev/hwdb.d/50-razer-pro-type-ultra.hwdb"
# apply (persistent) changes using "sudo systemd-hwdb update && sudo udevadm trigger"
evdev:input:b*v1532p027B*
KEYBOARD_KEY_c00e2=f1
KEYBOARD_KEY_c00ea=f2