Skip to content

Instantly share code, notes, and snippets.

🎵
Code for music

Hamid Alaei Varnosfaderani halaei

🎵
Code for music
Block or report user

Report or block halaei

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@halaei
halaei / nullable.php
Created Jul 22, 2019
Nullable helper
View nullable.php
<?php
class Nullable implements ArrayAccess, JsonSerializable
{
protected $value;
public function __construct($instance)
{
$this->value = $instance;
}
@halaei
halaei / find-pattern.c
Last active Mar 3, 2018
find pattern in string
View find-pattern.c
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
/**
* Hamming Weight
* Code from stackoverflow:
* @see https://stackoverflow.com/questions/109023/how-to-count-the-number-of-set-bits-in-a-32-bit-integer
*/
uint8_t numberOfSetBits(uint32_t i)
View pcntl_alarm.php
<?php
declare(ticks = 1);
class TimeoutException extends Exception {};
function signal_handler($signal) {
throw new TimeoutException();
}
@halaei
halaei / Install-php7.md
Created Jan 6, 2016 — forked from hollodotme/Install-php7.md
Installing php7-fpm with phpredis extension on Ubuntu 14.04
View Install-php7.md

Install php7.0-fpm

# remove php5 modules
apt-get autoremove --purge php5-*
# add php-7.0 source list by [Ondřej Surý](https://github.com/oerdnj)
add-apt-repository ppa:ondrej/php-7.0
# Update index
apt-get update
# Install php7.0-fpm with needed extensions
You can’t perform that action at this time.