Skip to content

Instantly share code, notes, and snippets.

View Burakhan's full-sized avatar
🎯
Focusing

Burakhan Ozyol Burakhan

🎯
Focusing
View GitHub Profile
@Burakhan
Burakhan / loadClass.php
Last active December 16, 2015 22:19
php __autoload class "lib/{className}.php
<?php
/**
* @param mixeds $className
**/
function __autoload($className){
$file = "./lib/{$className}.php";
if(file_exists($file)){
require_once($file);
}else{
@Burakhan
Burakhan / example1.php
Created May 2, 2013 23:44
__toString && __call
<?php
class example {
const val = "print value";
public function __toString(){
return self::val;
}
public function __call($name,$arr){
echo "There is no method called {$name}";
bin,banka_kodu,banka_adi,type,sub_type,virtual,prepaid
413226,10,T.C. ZİRAAT BANKASI A.Ş.,VISA,PLATINUM
444676,10,T.C. ZİRAAT BANKASI A.Ş.,VISA,CLASSIC
444677,10,T.C. ZİRAAT BANKASI A.Ş.,VISA,GOLD
444678,10,T.C. ZİRAAT BANKASI A.Ş.,VISA,PLATINUM
453955,10,T.C. ZİRAAT BANKASI A.Ş.,VISA, CLASSIC
453956,10,T.C. ZİRAAT BANKASI A.Ş.,VISA, GOLD
454671,10,T.C. ZİRAAT BANKASI A.Ş.,VISA, CLASSIC
454672,10,T.C. ZİRAAT BANKASI A.Ş.,VISA, CLASSIC
454673,10,T.C. ZİRAAT BANKASI A.Ş.,VISA, BUSINESS
@Burakhan
Burakhan / ssh.rbs
Last active January 1, 2016 22:59
Vagrant NTFS user permision problem # file path /opt/vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/util/ssh.rb
require "log4r"
require 'childprocess'
require "vagrant/util/file_mode"
require "vagrant/util/platform"
require "vagrant/util/safe_exec"
require "vagrant/util/subprocess"
require "vagrant/util/which"
@Burakhan
Burakhan / breadcrump.twig
Last active January 2, 2016 22:12 — forked from mortendk/breadcrump.twig
Basic breadcrump for twig
{% if breadcrumb is defined %}
<ol class="breadcrumb">
<li><a href="{{ path('home_page_route') }}"><i class="fa fa-dashboard"></i>Home Page</a></li>
{% for route, name in breadcrumb %}
{% set params = {} %}
{% if name is iterable %}
{% set params = name.params %}
{% set name = name.name %}
{% endif %}
{% if loop.first %}

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

  1. Routing. In routing.yml I have added all the routes for both bundles.
  2. Configuration. I have set the config.yml mostly as it is presented in the HWIOAuthBundle.
  3. Security. I have set the security.yml mostly as it is presented in the HWIOAuthBundle (though my routes are using /login pattern, not /connect). Also, the oauth_user_provider is set for my custom service.
@Burakhan
Burakhan / index.xml.twig
Created May 6, 2014 02:06
Syfony Simple Sitemap
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% for url in urls %}
<url>{# check if hostname is not alreay in url#}
<loc>http://{%if url.loc|replace({hostname:''}) == url.loc%}{{hostname}}{{url.loc}}{%else%}{{url.loc}}{%endif%}</loc>
{% if url.lastmod is defined %}
<lastmod>{{url.lastmod}}</lastmod>
{% endif %}
{% if url.changefreq is defined %}
<changefreq>{{url.changefreq}}</changefreq>
@Burakhan
Burakhan / my_sacrifice.md
Created November 8, 2016 23:31
The motherf*cking way the get Oracle access in PHP5 over Ubuntu
@Burakhan
Burakhan / delete_cascade.sql
Created December 31, 2016 22:20
postgres cascade delete
-- select delete_cascade('public','my_table','1');
create or replace function delete_cascade(p_schema varchar, p_table varchar, p_key varchar, p_recursion varchar[] default null)
returns integer as $$
declare
rx record;
rd record;
v_sql varchar;
v_recursion_key varchar;
recnum integer;
v_primary_key varchar;
@Burakhan
Burakhan / cx_oracle.md
Created March 8, 2018 07:54 — forked from kimus/cx_oracle.md
Installing python cx_oracle on Ubuntu

First of all, it just seems like doing anything with Oracle is obnoxiously painful for no good reason. It's the nature of the beast I suppose. cx_oracle is a python module that allows you to connect to an Oracle Database and issue queries, inserts, updates..usual jazz.

Linux

Step 1:

sudo apt-get install build-essential unzip python-dev libaio-dev

Step 2. Click here to download the appropriate zip files required for this. You'll need: