Skip to content

Instantly share code, notes, and snippets.

View keenahn's full-sized avatar
🧙

Keenahn Tiberius Jung keenahn

🧙
View GitHub Profile
#
# At CoverHound, we use conditional validations all over the form. However, there is no proper way to do
# this in Rails. Instead, we can provide an array of attributes (validated_fields attribute)
# and ensure they are the only ones to get validated.
#
module ConditionalValidations
attr_accessor :validated_fields
def field_is_required?(field)
@keenahn
keenahn / colortrans.py
Created May 4, 2017 02:43 — forked from MicahElliott/colortrans.py
Convert values between RGB hex codes and xterm-256 color codes.
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
@keenahn
keenahn / 1-main.css
Last active January 24, 2019 18:10
Dark Asana Style with Less Elements
/* Dark theme */
/* Source Sans Pro,Lato,apple-system, */
.CustomPropertyHeader-fieldHeading--highlighted .CustomPropertyHeader-fieldName {
color: #fff;
}
.TeamOverview-inner, .TeamOverview-scrollable {
background: #222;
}
@keenahn
keenahn / git-default-branch.sh
Last active November 16, 2023 10:21
A simple bash script to check if the default branch is main or master for a given repo
#!/bin/bash
# Check if the remote 'origin' has a 'main' branch
if git show-branch remotes/origin/main > /dev/null 2>&1; then
echo "main"
else
echo "master"
fi