Skip to content

Instantly share code, notes, and snippets.

View davidas13's full-sized avatar
🎯
Learn for life! 🧬 Don't rely on Magic ✨

David Satrio davidas13

🎯
Learn for life! 🧬 Don't rely on Magic ✨
View GitHub Profile
@davidas13
davidas13 / video-player.html
Last active March 3, 2020 00:36 — forked from simonhaenisch/video-player.html
Play local video files in the browser (HTML5 video player) with playlist, speed control and keyboard shortcuts for pause (spacebar) and 5 second jump (left/right arrow). Created to watch Wes Bos tutorials offline. Playback speed defaults to 2x.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Local HTML5 Video Player</title>
</head>
<body>
<style>
* { box-sizing: border-box; }
@davidas13
davidas13 / worker-threadpool.py
Created February 13, 2020 06:16 — forked from ksvbka/worker-threadpool.py
Demo worker threadpool and report progress in PyQT.
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QVBoxLayout, QPushButton, QWidget
from PyQt5.QtCore import QObject, QRunnable, QThreadPool,pyqtSlot, pyqtSignal
import time
import traceback, sys
class WorkerSignals(QObject):
'''
Defines the signals available from a running worker thread.
Supported signals are:
# This is a really old post, in the comments (and stackoverflow too) you'll find better solutions.
def find(key, dictionary):
for k, v in dictionary.iteritems():
if k == key:
yield v
elif isinstance(v, dict):
for result in find(key, v):
yield result
elif isinstance(v, list):
@davidas13
davidas13 / Dock.py
Created January 31, 2020 07:30 — forked from mottosso/Dock.py
Simple way to dock Qt widgets to Maya 2017+
from maya import cmds, OpenMayaUi as omui
from Qt import QtWidgets, QtCore, QtCompat
def Dock(Widget, width=300, show=True):
"""Dock `Widget` into Maya
Arguments:
Widget (QWidget): Class
show (bool, optional): Whether to show the resulting dock once created
@davidas13
davidas13 / trail.gd
Created December 10, 2019 11:16 — forked from iRadEntertainment/trail.gd
Godot Engine (GDscript) - 2D adjustable trail by Yellatch Games
#Draw trails with lines
#A NON-PERFECT SCRIPT FOR Godot v2.1.* *NOTE THIS SCRIPT STILL HAVE SOME REF ISSUES, CHECK FOR ERRORS IN THE DEBUGGER
#This script has to be attached to scene with only a Control Node
#This scene can be instanced as child of a moving node
#after that the code can be initialized calling scia_setup() func:
#arguments ( nuovo_oggetto = "the parent node reference goes here"
num_step = "number of steps (50 by default)
nuovo_colore = Color() (Opaque white by default)
nuova_trasp = Initial alpha transparency (adjust the formula for other fading effects)
@davidas13
davidas13 / version_controll_addon.gd
Created November 4, 2019 05:45 — forked from marcosbitetti/version_controll_addon.gd
A version control helper to using in Godot Engine
##
# Automatic versioning the code using GIT
# need GIT instaled on OS
func _dev_auto_commit():
if OS.is_debug_build():
var path = '/usr/bin/git'
var finder = File.new()
if not finder.file_exists(path):
if finder.file_exists('/usr/sbin/git'):
path = '/usr/sbin/git'
@davidas13
davidas13 / swipe.lua
Created October 14, 2019 13:11 — forked from AGulev/swipe.lua
adoptation of swipe-direction script by ScottPhillips https://github.com/ScottPhillips/swipe-direction/blob/master/swipe-direction.lua for Defold engine
local beginX
local beginY
local endX
local endY
local startTime
local xDistance
local yDistance
@davidas13
davidas13 / godot_style_guide.md
Created September 20, 2019 12:22 — forked from fire/godot_style_guide.md
godot_style_guide

Example Project Content Structure

|-- addons
|   |-- auto_lod
|   |   |-- art
|   |   |-- core
|   |   |-- binaries
|   |-- spring_arm
|-- generic_shooter
@davidas13
davidas13 / attrdict.py
Created September 5, 2019 13:28 — forked from turicas/attrdict.py
Python class with dict-like get/set item
#!/usr/bin/env python
# coding: utf-8
class AttrDict(object):
def __init__(self, init=None):
if init is not None:
self.__dict__.update(init)
def __getitem__(self, key):
return self.__dict__[key]
/*Complex Selector Example*/
QLineEdit { color: red }
QLineEdit[readOnly="true"] { color: gray }
QDialog QLineEdit { color: brown }
/*Customizing QAbstractScrollArea*/
QTextEdit, QListView {
background-color: white;
background-image: url(draft.png);
background-attachment: scroll; /*If the background-image is to be fixed with the viewport: scroll or fixed*/
}