Class names are CamelCase
.
Methods and variables are snake_case
.
Methods with a ?
suffix will return a boolean.
# The MIT License | |
# SPDX short identifier: MIT | |
# Further resources on the MIT License | |
# Copyright 2017 Denis Gladkikh (https://www.outcoldman.com/en/archive/2017/07/19/dbhist/) | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
# Source: https://gist.github.com/8adaf8fd6496bc99a466ba55834e1838 | |
############################################################### | |
# Metacontroller - Custom Kubernetes Controllers The Easy Way # | |
# https://youtu.be/3xkLYOpXy2U # | |
############################################################### | |
# Additional Info: | |
# - Metacontroller: https://metacontroller.github.io/metacontroller | |
# - DevOps MUST Build Internal Developer Platform (IDP): https://youtu.be/j5i00z3QXyU |
class InitialMigration < ActiveRecord::Migration[5.0] | |
def change | |
enable_extension "pgcrypto" unless extension_enabled?("pgcrypto") | |
end | |
end |
# Redis Cheatsheet | |
# All the commands you need to know | |
redis-server /path/redis.conf # start redis with the related configuration file | |
redis-cli # opens a redis prompt | |
# Strings. |
#!/usr/bin/liquidsoap | |
set("server.telnet", true) | |
files = playlist( | |
mode = "normal", | |
id = "files", | |
"PATH_TO_PLAYLIST.m3u" | |
) |
#!/bin/bash | |
# This way you can customize which branches should be skipped when | |
# prepending commit message. | |
if [ -z "$BRANCHES_TO_SKIP" ]; then | |
BRANCHES_TO_SKIP=(master develop test) | |
fi | |
BRANCH_NAME=$(git symbolic-ref --short HEAD) | |
BRANCH_NAME="${BRANCH_NAME##*/}" |
FROM ruby:2.6.3-alpine3.9 | |
RUN apk update && apk add libpq nodejs | |
ENV RAILS_ROOT /app | |
RUN mkdir -p $RAILS_ROOT | |
ENV BUNDLER_VERSION 2.0.2 | |
WORKDIR $RAILS_ROOT | |
RUN echo 'gem: --no-ri --no-rdoc' > ~/.gemrc | |
COPY Gemfile Gemfile | |
COPY Gemfile.lock Gemfile.lock | |
RUN apk add --virtual build-dependencies build-base gcc wget git postgresql-dev \ |
import os | |
from django.http import HttpResponse | |
from django.shortcuts import render | |
from django.utils.functional import wraps | |
from django.utils import simplejson | |
def render_to(view=None, template_name=None): | |
""" |
#+TITLE: Customize Save In Django Admin Inline Form | |
* Background | |
This is a common case in django ORM. | |
#+begin_src python | |
from django.db import models | |
class Author(models.Model): |