Skip to content

Instantly share code, notes, and snippets.

View RANUX's full-sized avatar
🏠
👉JavaScript dev. Open for job offerings

Alexander RANUX

🏠
👉JavaScript dev. Open for job offerings
View GitHub Profile
@RANUX
RANUX / gist:5894571
Created June 30, 2013 09:54
Extended Enum with attributes
public class EnumExtension
{
enum Test {
[Description("This is a foo")]
Foo,
[Description("This is a bar")]
Bar
}
@RANUX
RANUX / gist:6683463
Last active December 23, 2015 19:29
C# Extend Dictionary to find Key by Value
public static class DictionaryUtils
{
public static string FindKey(this IDictionary<string, string> lookup, string value)
{
foreach (var pair in lookup)
{
if (pair.Value == value)
return pair.Key;
}
return "";
@RANUX
RANUX / Unity3d object (sprite) movement
Last active December 24, 2015 01:59
Unity3d + tk2d sprite movement
using UnityEngine;
public class MoveSprite : MonoBehaviour
{
public tk2dSprite sprite;
float Speed = 50f; // 50 meters per second
Vector3 TopRightPoint;
Vector3 BottomLeftPoint;
@RANUX
RANUX / Unity3d screen coordinates to world point
Created September 30, 2013 08:40
TIP: C# Unity3d screen coordinates to world point
using UnityEngine;
public class UIRandomSpriteSeeder : MonoBehaviour
{
private Vector3 TopRightPoint;
private Vector3 BottomLeftPoint;
void Start()
{
BottomLeftPoint = Camera.main.ScreenToWorldPoint( Vector3.zero );
@RANUX
RANUX / recursion-examples.js
Last active March 5, 2016 13:49
Simple recursion examples on javascript
// factorials
function factorial(n) {
if ( n == 0 ) return 1;
return n * factorial( n - 1 );
}
// triangle numbers
function triangle(n) {
if ( n == 1 ) return 1;
return n + triangle(n-1);
}
@RANUX
RANUX / docker_cheat.md
Created July 18, 2016 15:35 — forked from wsargent/docker_cheat.md
Docker cheat sheet
@RANUX
RANUX / bash_keyboard_shortcuts.txt
Created July 22, 2016 12:29
Bash Keyboard Shortcuts
Bash Keyboard Shortcuts
Moving the cursor:
Ctrl + a Go to the beginning of the line (Home)
Ctrl + e Go to the End of the line (End)
Ctrl + p Previous command (Up arrow)
Ctrl + n Next command (Down arrow)
Alt + b Back (left) one word
Alt + f Forward (right) one word
@RANUX
RANUX / bashkeys.sh
Created July 22, 2016 13:00
Bash keyboard shortcuts script
#!/bin/bash
# Copy this script to /usr/local/bin or to any bin folder you like. Make executable and use it.
# cp bashkeys.sh /usr/local/bin
# cmod 755 /usr/local/bin/bashkeys.sh
# bashkeys.sh
echo '
Bash Keyboard Shortcuts
Moving the cursor:
@RANUX
RANUX / vim_cheatsheet.md
Created July 22, 2016 13:03 — forked from awidegreen/vim_cheatsheet.md
Vim shortcuts

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@RANUX
RANUX / комбинации-клавиш-bash.txt
Last active September 13, 2024 08:30
Комбинации клавиш для Bash
##### Перемещение курсора:
Ctrl + a — переход в начало строки
Ctrl + b — переход на 1 символ назад
Ctrl + c — посылает программе SIGINT. Обычно, прерывает текущее задание
Ctrl + d — удаляет символ под курсором (аналог delete)
Ctrl + e — переход к концу строки
Ctrl + f — переход на 1 символ вперёд
Ctrl + xx — переходит от текущей позиции курса в начало строки и обратно.
Ctrl + p — Предыдущая команда (Стрелка вверх)