Skip to content

Instantly share code, notes, and snippets.

View mihai-vlc's full-sized avatar

Mihai Ionut Vilcu mihai-vlc

View GitHub Profile
@mihai-vlc
mihai-vlc / conio.h
Last active December 18, 2015 02:09
CPP: getch() on linux
// found on http://stackoverflow.com/a/7469410/1579481
#include <termios.h>
#include <stdio.h>
static struct termios old, newp;
/* Initialize new terminal i/o settings */
void initTermios(int echo)
{
tcgetattr(0, &old); /* grab old terminal i/o settings */
@mihai-vlc
mihai-vlc / vaild_email.php
Last active December 17, 2015 17:59
PHP: isValidMail
<?php
function isValidMail($mail) {
if(!filter_var($mail, FILTER_VALIDATE_EMAIL))
return FALSE;
if(!checkdnsrr("gmail.com", "MX")) // if we have no internet access on the server
return TRUE;