Skip to content

Instantly share code, notes, and snippets.

export var viewportResizeStanddown = 0.5
var viewportResizeCounter = 0.0
signal settingsChanged()
signal particlesSettingsChanged()
signal removeGpuParticles()
func forbidParticles(time):
particlesForbiddenCounter = time
particlesForbidden = true
@tjukic
tjukic / spritepreview
Created June 25, 2019 10:44
sprite preview
using UnityEngine;
using UnityEditor;
[CustomPropertyDrawer(typeof(Sprite))]
public class SpritePropertyDrawer : PropertyDrawer
{
public override float GetPropertyHeight(SerializedProperty property, GUIContent labelN)
{
if (property.objectReferenceValue != null)
{
@tjukic
tjukic / main.cpp
Last active March 6, 2017 14:04
Prepend line nums - c++
#include "stdafx.h"
#include <fstream>
#include <string>
using namespace std;
int main() {
std::string srcline, nt;
auto li = 0;
std::ifstream tf("pocetni.txt");
@tjukic
tjukic / prependLineNum.ps
Last active March 6, 2017 12:40
Prepend line number to a file in PowerShell
$file = "pocetni.txt"
$t = (Get-Content $file)
$nt = New-Object System.Collections.ArrayList
for ($i=0;$i -lt $t.count; $i ++) { $nt += "[$($i + 1)]" + $t[$i] }
$nt | tee zavrsni.txt
@tjukic
tjukic / searcharraybyprop.js
Created March 4, 2017 09:45
Search by obj prop
Array.prototype.indexOfIfPropertyMatches = function(callback) {
var i = this.length;
while (i--) {
if (callback(this[i], i)) {
return i;
}
}
return -1;
};
@tjukic
tjukic / FocusThiefBuster
Created December 22, 2014 22:31
(Windows) Keeps track of applications taking focus. Made to find out what process is stealing focus, thus preventing typing and minimizing fullscreen apps.
#include "stdafx.h"
#include "Windows.h"
#include "Oleacc.h"
#include "Psapi.h"
#include <iostream>
//#define _WIN32_WINNT 0x0602
#ifdef _UNICODE
#define tcout std::wcout
@tjukic
tjukic / Multicore prime calc.cpp
Last active August 29, 2015 14:11
Prime calculator, multicore (auto max)
// CAUTION: This code puts your CPU at 100% load.
#include <string>
#include <iostream>
#include <thread>
#include <math.h>
void task()
{
int N = 999999999;