Skip to content

Instantly share code, notes, and snippets.

View Xevion's full-sized avatar
⚜️
Noblesse Oblige

Xevion Xevion

⚜️
Noblesse Oblige
View GitHub Profile

Keybase proof

I hereby claim:

  • I am xevion on github.
  • I am xevion (https://keybase.io/xevion) on keybase.
  • I have a public key ASAm89LfSNcdbKWjNBgQHChPenOqyJRNxS7b_vF7uSNpYAo

To claim this, I am signing this object:

let prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService);
let autocomplete = 'browser.urlbar.autoFill';
let history = 'browser.urlbar.suggest.history';
prefs.setBoolPref(history, !prefs.getBoolPref(history));
prefs.setBoolPref(autocomplete, !prefs.getBoolPref(autocomplete));
@luhn
luhn / getter_and_setter.py
Created November 29, 2012 18:35
Using getters and setters with SQLAlchemy
class Table(Base):
id = Column(Integer, primary_key=True)
_name = Column('name', String(24))
@property
def name(self):
return self._name;
@name.setter
def name(self, value):
@brenopolanski
brenopolanski / vue-axios-cors.md
Last active August 14, 2023 10:10
Vue.js + Axios + CORS

Proxy requests using Webpack dev server to avoid cors in development mode.

In your webpack.config file add:

"devServer":{
  "proxy": {
    "/api": {
    "target": 'https://my-target.com',
    "pathRewrite": { '^/api': '' },
@vor0nwe
vor0nwe / clip
Last active September 13, 2023 14:59
clip: WSL bash script to access the Windows Clipboard (both read and write)
#!/bin/bash
[[ ! -t 1 ]] && powershell.exe Get-Clipboard
[[ ! -t 0 ]] && clip.exe
if [[ -t 1 && -t 0 ]]; then
echo Nothing specified to copy or paste! >&2
exit 1
fi
@jtomaszewski
jtomaszewski / useFormFieldWarning.ts
Last active November 8, 2023 11:45
Hook for `react-hook-form` that lets you maintain state of a form field's warning (that is: an error that doesn't prohibit the form from being submitted).
import { useCallback, useState, useEffect, useRef } from "react";
import {
LiteralToPrimitive,
UnpackNestedValue,
useFormContext
} from "react-hook-form";
import { useDebouncedCallback } from "use-debounce";
/**
* Returns state of a warning for the given form field.
@EvieePy
EvieePy / error_handler.py
Last active January 16, 2024 15:12
Simple Error Handling for ext.commands - discord.py
"""
If you are not using this inside a cog, add the event decorator e.g:
@bot.event
async def on_command_error(ctx, error)
For examples of cogs see:
https://gist.github.com/EvieePy/d78c061a4798ae81be9825468fe146be
For a list of exceptions:
https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#exceptions
# Usage: python3 tldr_fail_test.py ${HOSTNAME}
#
# You can optionally pass the destination IP with --addr
#
# Author: davidben [at] chromium [dot] org
import argparse
import socket
import time
@JonnyWong16
JonnyWong16 / update_all_metadata.py
Last active March 19, 2024 17:31
Updates all metadata in the Tautulli database after moving Plex libraries.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Description: Updates all metadata in the Tautulli database after moving Plex libraries.
# Author: /u/SwiftPanda16
# Requires: plexapi, requests
from plexapi.server import PlexServer
import requests
@magicznyleszek
magicznyleszek / css-selectors.md
Last active March 29, 2024 01:12
CSS Selectors Cheatsheet

CSS Selectors Cheatsheet

Hi! If you see an error or something is missing (like :focus-within for few years :P) please let me know ❤️

Element selectors

Element -- selects all h2 elements on the page

h2 {