Skip to content

Instantly share code, notes, and snippets.

View kirillrybin's full-sized avatar
🏠
Working from home

Kirill Rybin kirillrybin

🏠
Working from home
  • Yaroslavl', Russia
  • 16:20 (UTC +03:00)
View GitHub Profile
@Romaleks360
Romaleks360 / SerializedDictionary.cs
Last active April 26, 2023 19:38
Serialized Dictionary for Unity
using System.Collections.Generic;
using UnityEngine;
namespace Utils
{
[System.Serializable]
public class SerializedDictionary<TKey, TValue> : Dictionary<TKey, TValue>, ISerializationCallbackReceiver
{
[SerializeField] List<Pair> _pairs;

Это краткая памятка, которая подходит во время вспышки любого респираторного вирусного заболевания. Я ее пишу не для того, чтобы вы срочно начинали все это делать - никакого повода нет. Но, если вы хотите снизить вероятность получения или распространения вирусов - прочитайте.

Общее поведение

  1. Контролируйте свою панику. Никакого повода для паники нет, как говорил человек, падающий с пятого этажа, пролетая мимо четвертого: “пока все нормально”. Напомню, уже на вашей памяти у людей была такая же паника из-за птичьего гриппа и атипичной пневмонии. И никакого зомби-апокалипсиса не произошло. Контролировать панику - значит следить за своими реакциями и стараться принимать решения разумно.
  2. Не осуждайте чужую панику. Это не помогает ни вам, ни паникующим - каждый человек волен паниковать или не паниковать перед лицом любой опасности. Кроме того, активное осуждение паники вокруг “эпидемий” порождает и подпитывает многочисленные теории заговора, так что просто не надо.
  3. Примите разумные меры предосторожно
@illescasDaniel
illescasDaniel / SlideAnimationTabBarController.swift
Last active April 11, 2022 14:03 — forked from benvium/MyTabBar.m
[Updated to Swift 4] - UITabBarController slide animation. Slide left and right when tabs are selected. Based on code from StackOverflow
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
if let fromView = tabBarController.selectedViewController?.view,
let toView = viewController.view, fromView != toView,
let controllerIndex = self.viewControllers?.index(of: viewController) {
let viewSize = fromView.frame
let scrollRight = controllerIndex > tabBarController.selectedIndex
// Avoid UI issues when switching tabs fast
@JohnSundell
JohnSundell / Perform.swift
Last active December 21, 2019 14:43
A function that enables you to easily wrap throwing APIs, to provide a custom error
/**
* Perform a throwing expression, and throw a custom error in case the expression threw
*
* - parameter expression: The expression to execute
* - parameter error: The custom error to throw instead of the expression's error
* - throws: The given error
* - returns: The return value of the given expression
*/
func perform<T>(_ expression: @autoclosure () throws -> T, orThrow errorExpression: @autoclosure () -> Error) throws -> T {
do {
using System.Linq;
using System.Text;
using UnityEngine;
public class D
{
/// <summary>
/// Author: WeslomPo
/// InspiredBy: Ant.Karlov
@heartgamer
heartgamer / SimpleChat.cs
Created November 19, 2015 05:21
BEST HTTP socket.io example.
using UnityEngine;
using System.Collections;
using System;
using BestHTTP;
using BestHTTP.SocketIO;
public class SimpleChat : MonoBehaviour {
public UILabel lblChatMessages;
@detomon
detomon / CGAffineTransform.swift
Last active January 10, 2024 15:26
Convenient operator overloadings for CGPoint, CGSize and CGRect
import Foundation
/**
* CGAffineTransform
*
* var a = CGAffineTransformMakeRotation(45.0 * M_PI / 180.0)
* var b = CGPointMake(30.0, 43.3)
*/
/**
@NoobsArePeople2
NoobsArePeople2 / gist:5121597
Last active November 10, 2023 14:33
Configure media keys on a non-Apple keyboard to control Spotify via AppleScript and USB Overdrive on OSX.

Requirements

  1. USB Overdrive
  2. A non-Apple keyboard with media keys (or keys you want to make "media" keys). For reference, I'm using a Microsoft Sidewinder X4

Set Up

  1. Plug in your keyboard and install USB Overdrive.
  2. Open USB Overdrive. Click into the Settings tab.
  3. Click the dropdown and select "Any Keyboard, Any Application"
@bzgeb
bzgeb / TriggerContainerEditor.cs
Created September 28, 2012 14:52
Example Drag & Drop area in a custom inspector for the Unity editor
using UnityEngine;
using System.Collections;
using UnityEditor;
[CustomEditor (typeof(TriggerContainer))]
public class TriggerContainerEditor : Editor
{
private SerializedObject obj;
@GarethJones
GarethJones / MiniJson.cs
Created January 12, 2012 17:32
MiniJson Flash Unity version
// using UnityEngine;
using System;
using System.Collections;
using System.Text;
/* Based on the JSON parser from
* http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
*
* I simplified it so that it doesn't throw exceptions
* and can be used in Unity iPhone with maximum code stripping.