Skip to content

Instantly share code, notes, and snippets.

View aprius's full-sized avatar
:shipit:
ops

Aprius aprius

:shipit:
ops
View GitHub Profile
using UnityEngine;
namespace DesignPatterns.OCP
{
public class AreaCalculator
{
// new implementation: use open-closed principle
// let each Shape contain the logic for calculating the area
public float GetArea(Shape shape)
@aprius
aprius / Player.cs
Last active November 2, 2022 14:02
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace DesignPatterns.SRP
{
[RequireComponent(typeof(PlayerAudio), typeof(PlayerInput), typeof(PlayerMovement))]
public class Player : MonoBehaviour
{
[SerializeField] private PlayerAudio playerAudio;
@aprius
aprius / Change.cs
Last active October 26, 2022 16:26
private void Update()
{
#if UNITY_EDITOR
if (Input.GetMouseButtonDown(0))
{
var pos = Input.mousePosition;
}
#else
if (Input.touchCount > 0)
{
using UnityEngine;
public class CameraFollow : MonoBehaviour
{
public Transform hina;
private void Update()
{
var hinaPosition = hina.position;
hinaPosition.y = 1f;
@aprius
aprius / AddTransform.cs
Last active October 24, 2022 16:52
shortcode for transform
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
private void Start()
{
gameObject.AddComponent<Transform>();
}
}
using UnityEngine;
public class AwakeClass : MonoBehaviour
{
void Awake()
{
}
}
// class cơ sở
public class Parent
{
protected void ParentFeature()
{
// chức năng kế thừa
}
}
// class dẫn suất (kế thừa class Parent)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FirstClass : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
@aprius
aprius / fishes.js
Created September 22, 2022 17:40
fish footer for hexo butterfly theme
fish();
function fish() {
return (
$("footer").append(
'<div class="container" id="jsi-flying-fish-container"></div>'
),
$(".container").css({
width: "100%",
height: "160px",
margin: 0,
@aprius
aprius / sakura.js
Created September 18, 2022 18:41
sakura.js
var stop, staticx;
var img = new Image();
img.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUgAAAEwCAYAAADVZeifAAAACXBIWXMAAACYAAAAmAGiyIKYAAAHG2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDIgNzkuMTYwOTI0LCAyMDE3LzA3LzEzLTAxOjA2OjM5ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXBSaWdodHM9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9yaWdodHMvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtcFJpZ