Skip to content

Instantly share code, notes, and snippets.

View teomaragakis's full-sized avatar

Teo Maragakis teomaragakis

  • Athens, Greece
  • 10:20 (UTC +02:00)
View GitHub Profile
@teomaragakis
teomaragakis / hc-548.ino
Last active November 25, 2015 16:01
HC-548 matrix keypad test code. Read the full blog post on www.teomaragakis.com/hardware/electronics/testing-the-hc-548-matrix-keypad/
/*
+-----+
+----[PWR]-------------------| USB |--+
| +-----+ |
| GND/RST2 [ ][ ] |
| MOSI2/SCK2 [ ][ ] A5/SCL[ ] | C5
| 5V/MISO2 [ ][ ] A4/SDA[ ] | C4
| AREF[ ] |
| GND[ ] |
| [ ]N/C SCK/13[ ] | B5
@teomaragakis
teomaragakis / playerController.cpp
Last active December 18, 2017 05:58
Sample code for my 2D Zelda Unity tutorial which can be found here: http://www.teomaragakis.com/game-development/creating-2d-zelda-clone-unity/
using UnityEngine;
using System.Collections;
public class playerController : MonoBehaviour {
private Animator animator;
// Use this for initialization
void Start () { animator = this.GetComponent(); }
// Update is called once per frame
void Update () {
float v = Input.GetAxis("Vertical");
@teomaragakis
teomaragakis / HC-SR04.ino
Last active November 25, 2015 12:54
HC-SR04 ultrasonic range finder test code. Read the full blog post on www.teomaragakis.com/hardware/electronics/testing-the-hc-sr04-ultrasonic-range-sensor/
/*
+-----+
+----[PWR]-------------------| USB |--+
| +-----+ |
| GND/RST2 [ ][ ] |
| MOSI2/SCK2 [ ][ ] A5/SCL[ ] | C5
| 5V/MISO2 [ ][ ] A4/SDA[ ] | C4
| AREF[ ] |
| GND[ ] |
| [ ]N/C SCK/13[ ] | B5
@teomaragakis
teomaragakis / widgets.less
Created November 4, 2014 12:11
Bootstrap Extensions
// Variables
@widget-padding: 10px;
@widget-background-color @whiter;
@widget-text-color: @brand-secondary;
@widget-inverted-background-color: @brand-primary;
@widget-inverted-text-color: @white;
@teomaragakis
teomaragakis / greeklish.php
Last active November 15, 2024 15:43
A function that transforms greek characters to english (greeklish).
<?php
// Based on http://www.freestuff.gr/forums/viewtopic.php?p=194579#194579
function make_greeklish($text) {
$expressions = array(
'/[αΑ][ιίΙΊ]/u' => 'e',
'/[οΟΕε][ιίΙΊ]/u' => 'i',
'/[αΑ][υύΥΎ]([θΘκΚξΞπΠσςΣτTφΡχΧψΨ]|\s|$)/u' => 'af$1',
'/[αΑ][υύΥΎ]/u' => 'av',
'/[εΕ][υύΥΎ]([θΘκΚξΞπΠσςΣτTφΡχΧψΨ]|\s|$)/u' => 'ef$1',
'/[εΕ][υύΥΎ]/u' => 'ev',
@teomaragakis
teomaragakis / wp-menu-separator.php
Last active December 26, 2015 05:28
A function that adds a separator to the WordPress Dashboard menu. Call add_menu_separator($position) with a number parameter.
<?php
/**
* add_menu_separator function.
*
* A function that lets you add a menu separator on a given menu position.
*
* @access public
* @param mixed $position
* @return void