Skip to content

Instantly share code, notes, and snippets.

View dzava's full-sized avatar

Dimitris Zavantias dzava

View GitHub Profile
 using UnityEngine;
public static class ExtDebug
{
//Draws just the box at where it is currently hitting.
public static void DrawBoxCastOnHit(Vector3 origin, Vector3 halfExtents, Quaternion orientation, Vector3 direction, float hitInfoDistance, Color color)
{
origin = CastCenterOnCollision(origin, direction, hitInfoDistance);
DrawBox(origin, halfExtents, orientation, color);
}
@dzava
dzava / Makefile
Created February 3, 2020 23:11
RoR makefile
.DEFAULT_GOAL := run
runonly:
cd ./build/ && ./RunRoR -map simple2 -truck UnlimitedTrophyTruck.truck -enter
run: download
cd ./build/ && ./RunRoR -map simple2 -truck UnlimitedTrophyTruck.truck -enter
download: build
rsync -arzz vbox:/root/rigs-of-rods/redist/ ./build/
@dzava
dzava / script.sh
Last active February 3, 2019 15:09
Upgrade Ogre meshes for RigsOfRods
#!/usr/bin/env/ bash
rm -rf /tmp/upgrade
for archive in *.zip; do
unzip $archive -d /tmp/upgrade
for mesh in /tmp/upgrade/*.mesh; do
OgreMeshUpgrader $mesh
@dzava
dzava / AutoColor.js
Last active June 10, 2018 00:10
Plugin to automatically color chart.js datasets
const colors = [
{
backgroundColor: 'transparent',
borderColor: 'rgba(115,115,115,1)',
},
{
backgroundColor: 'transparent',
borderColor: 'rgba(241, 90, 96, 1)',
},
{
import bpy
context = bpy.context
scene = context.scene
def bones():
active = context.active_pose_bone
if active is context.selected_pose_bones[0]:
return [active, context.selected_pose_bones[1]]
return [active, context.selected_pose_bones[0]]
@dzava
dzava / app.js
Created December 13, 2017 11:33
Laravel mix hot module replacement for tailwindcss
require('../less/app.less')
@dzava
dzava / h-scroll.js
Created November 26, 2017 19:05
Chrome snippets
// Detect elements that add horizontal scroll to the page
docWidth = document.documentElement.offsetWidth
Array.from(document.getElementsByTagName("*")).filter(el => {
const rect = el.getBoundingClientRect()
return rect.right > docWidth || rect.left < 0
})
@dzava
dzava / .csscomb.json
Last active August 15, 2018 11:10
pre-commit hook to format stylesheets using csscomb
{
"exclude": [
".git/**",
"node_modules/**",
"bower_components/**"
],
"always-semicolon": true,
"block-indent": " ",
"color-case": "lower",
"color-shorthand": true,
export function scrollOffset(el) {
const box = el.getBoundingClientRect();
const body = document.body;
const docEl = document.documentElement;
const scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop;
const scrollLeft = window.pageXOffset || docEl.scrollLeft || body.scrollLeft;
const clientTop = docEl.clientTop || body.clientTop || 0;
@dzava
dzava / default.blade.php
Created January 31, 2017 02:03
Laravel bulma pagination
@if ($paginator->hasPages())
<nav class="pagination">
<a href="{{ $paginator->previousPageUrl() }}"
class="pagination-previous {{ $paginator->onFirstPage() ? 'is-disabled': '' }}">
Previous
</a>
<a href="{{ $paginator->nextPageUrl() }}"
class="pagination-next {{ !$paginator->hasMorePages() ? 'is-disabled': '' }}">