#! /usr/bin/env elixir | |
# Install required deps | |
Mix.install([:jason]) | |
# The pretty printing module | |
defmodule JsonPrettyPrinter do | |
def get_stdin_data do | |
# Fetch data from STDIN and decode JSON | |
:stdio |
" Specify a directory for plugins | |
call plug#begin('~/.vim/plugged') | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'scrooloose/nerdtree' | |
"Plug 'tsony-tsonev/nerdtree-git-plugin' | |
Plug 'Xuyuanp/nerdtree-git-plugin' | |
Plug 'tiagofumo/vim-nerdtree-syntax-highlight' | |
Plug 'ryanoasis/vim-devicons' | |
Plug 'airblade/vim-gitgutter' |
For users who prefer working with a command line or need to access advanced encoding settings for Hap the popular FFmpeg library can be used to work with Hap movies.
-
If this is your first time using FFmpeg you may need to install it on your system, or compile it from source. In either case be sure that Snappy is enabled as part of the binary. If you already have FFmpeg on your system with Snappy enabled, you can skip this step.
You can check that your version of FFmpeg can encode Hap using
ffmpeg -encoders | grep hap
defmodule Map.Helpers do | |
@moduledoc """ | |
Functions to transform maps | |
""" | |
@doc """ | |
Convert map string camelCase keys to underscore_keys | |
""" | |
def underscore_keys(nil), do: nil |
Because pointers can be ugh
To understand a pointer, let's review "regular" variables first. If you're familiar with a programming language without pointers like JavaScript, this is what you think when you hear "variable".
When declaring a variable by identifier (or name), the variable is synonymous with its value.
# Based on post from: https://snipt.net/chrisdpratt/symmetrical-manytomany-filter-horizontal-in-django-admin/#L-26 | |
# Only reposting to avoid loosing it. | |
""" | |
When adding a many-to-many (m2m) relationship in Django, you can use a nice filter-style multiple select widget to manage entries. However, Django only lets you edit the m2m relationship this way on the forward model. The only built-in method in Django to edit the reverse relationship in the admin is through an InlineModelAdmin. | |
Below is an example of how to create a filtered multiple select for the reverse relationship, so that editing entries is as easy as in the forward direction. | |
IMPORTANT: I have no idea for what exact versions of Django this will work for, is compatible with or was intended for. |
#! /usr/bin/env python | |
# | |
# Mixpanel, Inc. -- http://mixpanel.com/ | |
# | |
# Python API client library to consume mixpanel.com analytics data. | |
import hashlib | |
import urllib | |
import time | |
try: |
from django.contrib import admin | |
from django.contrib.auth import admin as auth_admin | |
from .models import * | |
from forms import UserChangeForm, UserCreationForm | |
class UserAdmin(auth_admin.UserAdmin): | |
fieldsets = ( | |
(None, {'fields': ('email', 'password')}), | |
('Personal info', {'fields': ('first_name', 'last_name', 'twitter', 'photo', 'event')}), |