Skip to content

Instantly share code, notes, and snippets.

View feyyazesat's full-sized avatar

Feyyaz Esatoglu feyyazesat

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@feyyazesat
feyyazesat / blockstack.id
Created November 8, 2017 21:01
Blockstack ID verification
Verifying my Blockstack ID is secured with the address 1NxhVEagZophCbq766T6QMZquyeYJ5bsf https://explorer.blockstack.org/address/1NxhVEagZophCbq766T6QMZquyeYJ5bsf
@feyyazesat
feyyazesat / violation-of-encapsulation-example.php
Created October 4, 2017 11:31
Violation of Encapsulation Example
<?php
/*
Following Explanation From Wikipedia
https://en.wikipedia.org/wiki/Encapsulation_(computer_programming)
Encapsulation is used to hide the values or state of a structured data object inside a class
*/
class AClass {
private $propertyDoesntViolateEncapsulation = 0;
private static $propertyViolatesEncapsulation = 0;
@feyyazesat
feyyazesat / main.c
Last active April 14, 2017 11:41
parallel programming : pi calculation.
#include <stdio.h>
#include <omp.h>
double piCalculation() {
static int num_total_steps = 100000;
int num_steps = (num_total_steps / omp_get_num_threads());
double step;
double sum = 0.0;
double execution_time = omp_get_wtime();
step = 1.0 / (double) num_total_steps;
@feyyazesat
feyyazesat / ext_stmt.txt
Created March 16, 2016 10:13
PHP EXT_STMT opcode training.
1. input -> empty file
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
2 0 E > > RETURN 1
2. input -> '<?php'
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
@feyyazesat
feyyazesat / multicomposer.sh
Last active December 24, 2015 13:30
Composer multiplier
#!/bin/bash
export SYMFONY_APP=$1
composer ${@:2}
# --usage ./multicomposer.sh api install
@feyyazesat
feyyazesat / validationannotation.php
Created August 26, 2015 10:32
validation annotation.
/**
* @var string
*
* @ORM\Column(name="firstname", type="string", length=45, nullable=true)
* @Assert\Length(
* min = 2,
* max = 45,
* minMessage = "user.form.validation.firstname.min",
* maxMessage = "user.form.validation.firstname.max",
* groups = {"personal_info"}
# Symfony bin path
set :bin_path, "bin"
# Symfony var path
set :var_path, "var"
# Symfony console path
set :symfony_console_path, fetch(:bin_path) + "/console"
# Symfony log path
#!/bin/bash
# include config
# config example below:
#
#
# Example deploy_config.sh
#
# dev_env() {
@feyyazesat
feyyazesat / connectionpoolingimplementation.go
Created March 17, 2015 18:56 — forked from rday/gist:3504712
an example of connection pooling implementation.
/**
This function creates a connection to the database. It shouldn't have to know anything
about the pool, It will be called N times where N is the size of the requested pool.
*/
func initCirrusConnections() (interface{}, error) {
dbserver, _ := configFile.GetString("default", "dbserver")
dbuser, _ := configFile.GetString("default", "dbuser")
dbpass, _ := configFile.GetString("default", "dbpass")
db := autorc.New("tcp", "", dbserver, dbuser, dbpass)