Skip to content

Instantly share code, notes, and snippets.

@bettysteger
bettysteger / userCtrl.js
Last active March 24, 2017 20:34
Custom angular form validation (Angular 1.2 vs 1.3)
/**
* Angular 1.2
* Helper method for Signup and Update. Checks if email or username of user exists per GET request.
* Sets custom validation: 'exists' to true or false.
* @example
* <input type="email" name="email" ng-model="user.email" ng-change="checkIfExists(form.email)" />
*/
var timeout = false;
$scope.checkIfExists = function(input) {
if(!input.$viewValue) { return; }
@hieuthi
hieuthi / all-vietnamese-syllables.txt
Last active February 8, 2023 21:35
All possibly existent Vietnamese syllables, created by combine all onsets with all rimes. More information can be found at: http://hieuthi.com/blog/2017/03/21/all-vietnamese-syllables.html
a
ai
am
an
ang
anh
ao
au
ay
ba
@aliostad
aliostad / stockfish-interface.txt
Created August 17, 2019 10:41
stockfish - Description of the universal chess interface (UCI)
COPIED FROM https://build.opensuse.org/package/view_file/games/stockfish/stockfish-interface.txt?expand=1
Description of the universal chess interface (UCI) April 2006
=================================================================
* The specification is independent of the operating system. For Windows,
the engine is a normal exe file, either a console or "real" windows application.
* all communication is done via standard input and output with text commands,
@danshick
danshick / trigger-screen-shot.py
Created March 4, 2021 19:34
Python script to trigger a screenshot via xdg-desktop-portal
#!/usr/bin/python3
# this used to live at https://gitlab.gnome.org/snippets/814
# but has since been deleted, the original author is unknown
# reuploading here for safe keeping
import dbus
import secrets
import re
@pschmitt
pschmitt / sway-maximize.sh
Last active March 26, 2024 01:01
sway ipc script to maximize the currently focused window
#!/usr/bin/env bash
usage() {
echo "Usage: $(basename "$0") [-d DEFAULT_BORDER_PX] [-m MAXIMIZED_BORDER_PX]"
}
get_waybar_height() {
# Waybar's config is JSONC, ie it contains comments. We need to strip
# these for jq.
grep -v '//' ~/.config/waybar/config | jq -er '.height'
@roberth
roberth / minimod.nix
Last active June 26, 2024 08:27
Simple and quick module system alternative + thoughts and tasks
/*
minimod: A stripped down module system
TODO Comparison:
- [ ] Come up with a benchmark "logic" using plain old functions and let bindings
- [ ] Write the benchmark for the module system
- [ ] Write the benchmark for POP?
- [ ] Qualitative comparison of extensibility in the context of composable
Nixpkgs packaging logic
TODO Fine-tuning: