Skip to content

Instantly share code, notes, and snippets.

@paulzi
paulzi / .gitlab-ci.yml
Last active March 1, 2023 10:08 — forked from Tymek/.gitlab-ci.yml
Static files server build for NodeJS→GitLab CI→Docker→Nginx pipeline
image: alpine
cache:
paths:
- node_modules/
before_script:
- DIST_DIR=$([ "$DIST_DIR" ] || echo "./dist")
stages:
@paulzi
paulzi / clean-up-boot-partition-ubuntu.md
Created May 27, 2020 09:01 — forked from z010107/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
<?php
namespace common\validators;
use yii\base\InvalidConfigException;
use Yii;
use yii\base\Model;
use yii\helpers\ArrayHelper;
use yii\validators\Validator;
class CompositeValidator extends Validator
@paulzi
paulzi / in-triangle.js
Created August 22, 2016 16:16
Check point in triangle
var inUV = function (uv, point) {
var x = point.x - uv[0].x;
var y = point.y - uv[0].y;
var s = (uv[1].x - uv[0].x) * y - (uv[1].y - uv[0].y) * x > 0;
if ((uv[2].x - uv[0].x) * y - (uv[2].y - uv[0].y) * x > 0 === s) {
return false;
}
return (uv[2].x - uv[1].x) * (point.y - uv[1].y) - (uv[2].y - uv[1].y) * (point.x - uv[1].x) > 0 === s;
};
@paulzi
paulzi / three-uvToGlobal.js
Last active March 13, 2023 22:43
Transform UV coordinate to global (Three.js)
/**
* @param {THREE.Mesh} mesh
* @param {THREE.Vector2} point
* @returns {THREE.Vector3[]}
*/
var uvToGlobal = function (mesh, point) {
var a, b, c, i, uv, face, uvs, faces, vertices, matrix, matrix2, point3, result;
result = [];
uvs = mesh.geometry.faceVertexUvs[0];
faces = mesh.geometry.faces;
@paulzi
paulzi / tristate-checkbox.html
Last active August 18, 2016 20:56
Tristate checkbox
<div>
<span class="tristate tristate-checkbox">
<input type="radio" id="item1-state-off" name="item1" value="-1" checked>
<input type="radio" id="item1-state-null" name="item1" value="0">
<input type="radio" id="item1-state-on" name="item1" value="1">
<i></i>
<label for="item1-state-null">Выключено</label>
<label for="item1-state-on">Не задано</label>
<label for="item1-state-off">Включено</label>
</span>