Skip to content

Instantly share code, notes, and snippets.

View kadko's full-sized avatar
🍀
On vacation

kadko

🍀
On vacation
View GitHub Profile
@kadko
kadko / single-product.php
Last active December 19, 2015 10:19
single-product.php file of wosci ecommerce system v6.5
<?php require('includes/application_top.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<title><?php
/*
* Print the <title> tag based on what is being viewed.
*/
@kadko
kadko / Ubuntu_LAMP_VSFTP_setup_MT_DV_server
Last active December 20, 2015 08:39
Mediatemple DV developer server ubuntu kurulum adımları ve notları
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/dendriteagate.com
sudo nano /etc/apache2/sites-available/dendriteagate.com aç ServerAdmin altına ekle
ServerName dendriteagate.com
ServerAlias www.dendriteagate.com
sonra DocumentRoot u değiştir
DocumentRoot /var/www/dendriteagate.com/public_html/
@kadko
kadko / yeni sunucuda oscommerce
Last active December 20, 2015 12:29
yeni sunucuda oscommerce için yapılması gerekenler
application_top.php dosyasında
navigation history kodunu değiştirdik
if (tep_session_is_registered('navigation')) {
if (PHP_VERSION < 4) {
$broken_navigation = $navigation;
$navigation = new navigationHistory;
$navigation->unserialize($broken_navigation);
} else {
$navigation = new navigationHistory;
@kadko
kadko / Network-puzzle-solver-Algoritm
Last active May 11, 2019 12:35
Net puzzle solver Algoritm
/*
Generate puzzle here: https://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/net.html
Generated puzzle stored to H array and outputs solution to same H array
makekomsu() finds border cells and neighbour cell states and arranges H array as output. This function invoked whenever H array changes.
solvePuzzle() checks for border and later checks locked(solved) neighbours connections
not tested for above 4x4,
Author: Kadir Korkmaz
*/
@kadko
kadko / replace between
Created August 7, 2017 13:34
Find from phrase to phrase in string and return or replace between
<?php
function iki_ifade_arasi($str, $k1, $k2, $k1k2dahil=false, $replace){
/*
$k1 ve $k2 arasındakileri döndürür (replace yoksa)
$k1 ve $k2 arasındakileri replace te verilen ile değiştirir (k1k2dahil true ise $k1, $k2 dahil olarak arasındaki değerler değiştirilir )
$k1 ve $k2 arasındakileri replace te verilen ile değiştirir (k1k2dahil false ise sadece $k1 ve $k2 arasındaki değerler verilenle değiştirilir )
$k1 ve $k2 den biri verilen $str yığınında bulunamazsa FALSE döndürür.
*/
$p = strpos($str, $k1);
$p2 = strpos($str, $k2, ($p + strlen($k1)));
@kadko
kadko / pubsub-simple.js
Created September 6, 2018 01:55 — forked from fatihacet/pubsub-simple.js
Simple PubSub implementation with JavaScript - taken from Addy Osmani's design patterns book -
var pubsub = {};
(function(q) {
var topics = {}, subUid = -1;
q.subscribe = function(topic, func) {
if (!topics[topic]) {
topics[topic] = [];
}
var token = (++subUid).toString();
topics[topic].push({
token: token,
<?php
ini_set('memory_limit', '-1');
ini_set('max_execution_time', 30000);
$sampleSQL = file_get_contents('sampleSQL.txt');
$past = 0;
$PIN = ');';
$PINlen = mb_strlen( $PIN );
$partSize = 0.2*1024*1024;//BYTES, 20MB
$len = mb_strlen($sampleSQL) / $partSize;
<?php
/* Big File Splitter v0.1
Kadir Korkmaz
*/
$fileStr = file_get_contents('sitemap.xml');
$past = 0;
$PIN = '</url>';//ENTER sitemap repetitive item element closing tag
$PINlen = mb_strlen( $PIN );
@kadko
kadko / PHP File Splitter (Keeps original file format)
Last active February 14, 2020 17:36
Outputs file to small parts as keeping original file data format
<?php
class splitFile{
private $fileName;
private $filecontents;
private $fileLen;
private $PIN;
private $partSize;
@kadko
kadko / substr_Index.php
Last active April 18, 2019 21:52
//Finds nth occourance of string after position of given needle. //Pass $needle argument as empty string [''] if you want to find from start //Pass $needle argument as Int to search string from this position
//Finds nth occourance of string after position of given needle.
//Pass $needle argument as empty string [''] if you want to find from start
//Pass $needle argument as Int to search string from this position
function substr_Index( $string, $needle, $delimiter, $nth ){
$str2 = '';
$posf = strpos($string, $needle);
if($posf !== false){
$string = substr($string, $posf);
$posTotal = $posf;