Skip to content

Instantly share code, notes, and snippets.

Avatar

Jason Kraus zbyte64

  • Kraus Dev House
  • Fresno, CA USA
View GitHub Profile
@zbyte64
zbyte64 / events.py
Created Nov 1, 2020
Example: Django-Graphene subscriptions with graphene_subscriptions and django_lifecycle
View events.py
from enum import Enum, auto
class NotificationEvents(Enum):
NEW_MESSAGE = auto()
UPDATE_MESSAGE = auto()
@zbyte64
zbyte64 / sample.py
Created Jun 27, 2016
Docker py put archive example
View sample.py
import tarfile
import time
from io import BytesIO
admin_password = 'xxxxx'
#write password to file
pw_tarstream = BytesIO()
pw_tar = tarfile.TarFile(fileobj=pw_tarstream, mode='w')
file_data = admin_password.encode('utf8')
@zbyte64
zbyte64 / hdhr-listings-to-m3u.py
Last active Dec 6, 2020 — forked from caseyavila/hdhr-listings-to-m3u.py
Convert HDHomeRun Prime Listings to M3U Format
View hdhr-listings-to-m3u.py
#!/usr/bin/env python
#
# this script will convert the hdhomerun listings (channels) to
# m3u format for use with external media players. before running
# this script, be sure to modify the <<config>> variable settings
# below.
#
# Suggested Usage: This script should be run on a cron to keep
# the channel lineup to date. Below is an example of how to execute this script:
# python /path/to/script/hdhomerun-prime-listings-to-m3u.py > /path/to/playlist.m3u
@zbyte64
zbyte64 / async_app.py
Created May 26, 2016
Asyncio Views With Django
View async_app.py
import asyncio
from django import http
from django.core.urlresolvers import set_script_prefix
from django.utils.encoding import force_str
from django.core.handlers.wsgi import get_script_name
from django_wsgi.handler import DjangoApplication
import logging
import logging
import sys
@zbyte64
zbyte64 / tdd.rst
Created Mar 5, 2014
Testosterone Driven Development [TDD]
View tdd.rst

A compilation of software development techniques using Steve Ballmer as a mentor. Feel free to fork & add.

http://www7.pcmag.com/media/images/238533-conference-speaker-steve-ballmer.jpg

@zbyte64
zbyte64 / build_arm.sh
Created Aug 17, 2018
Compile Stepmania 5.2 on the RaspberryPi
View build_arm.sh
#inside the Build directory of the source code:
cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Release -DWITH_SSE=OFF -DWITH_CRASH_HANDLER=OFF -DWITH_MINIMAID=OFF ..
cmake ..
make -j2
@zbyte64
zbyte64 / admin.py
Created Sep 6, 2017
Django select2 example
View admin.py
from django.contrib import admin
from .models import Blog
from .fields import UserSelectWidget
class BlogForm(forms.ModelForm):
class Meta:
model = Blog
exclude = []
@zbyte64
zbyte64 / cloneComponent.js
Created May 30, 2014
Deep cloning of react components
View cloneComponent.js
var _ = require('lodash');
function isComponent(obj) {
//ghetto check because JS
return (obj && obj.setState)
}
function deepCloneComponent(tpl) {
if (!tpl) return;
if (_.isArray(tpl)) {
@zbyte64
zbyte64 / guideline.rst
Last active Sep 15, 2016
React.js Component Guideline
View guideline.rst

React.js Minimal Entropy Guide

DO's:

  • Use explicit contracts to pipe data & events between systems
  • Business rules should bubble towards the top, UI and semantics should sink towards the bottom

DONT's:

@zbyte64
zbyte64 / alpaca-om.cljs
Created Jan 16, 2014
Render alpacajs form in OM (clojsurescript react.js library); AKA render raw html in OM
View alpaca-om.cljs
(defn show-form [data _]
(om/component
(let [schema (:current-form data)
alpaca-html (.html (.alpaca (js/jQuery. "<div/>") (clj->js {:schema schema})))
form-html (js/React.DOM.div (clj->js {:dangerouslySetInnerHTML {:__html alpaca-html}}))]
form-html)))