Skip to content

Instantly share code, notes, and snippets.

View stnc's full-sized avatar
🎯
Focusing

TUNÇ Selman stnc

🎯
Focusing
View GitHub Profile
@stnc
stnc / Magento:XML: Remove Footer links.xml
Last active February 9, 2018 11:53 — forked from cristianstan/Magento:XML: Remove Footer links.xml
Magento:XML: Remove Footer links
@stnc
stnc / OneSignalApi.php
Last active April 14, 2025 07:07
OneSignal APi php kısmı
<?php
$message="There is new news ";
$apiKey ="xxxx";//one signal api key
$AppID = "xxxx";////one signal api id
$content = array(
"en" => $message ,
"tr" => $message
@stnc
stnc / OneSignalNotfiy.html
Last active February 7, 2018 12:43
Onesignal php api türkçe
<script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async></script>
<script>
window.OneSignal = window.OneSignal || [];
// Do NOT call init() twice
// OneSignal.setDefaultTitle("My Title");
OneSignal.push(["init", {
autoRegister: false,
persistNotification:true,
/* Your other init options here */
@stnc
stnc / admin_pass.php
Last active January 30, 2018 16:12
Programmatically new Admin in Magento
<?php
require_once('app/Mage.php');
umask(0);
Mage::app();
$user = Mage::getModel('admin/user')->setData(array(
'username' => 'user123',
'firstname' => 'selman',
'lastname' => 'selman',
@stnc
stnc / modul.php
Created January 25, 2018 06:46
magento modul list
<?php
$folders = array('app/code/local/', 'app/code/community/', 'app/code/core/');//folders to parse
$configFiles = array();
foreach ($folders as $folder){
$files = glob($folder.'*/*/etc/config.xml');//get all config.xml files in the specified folder
$configFiles = array_merge($configFiles, $files);//merge with the rest of the config files
}
$rewrites = array();//list of all rewrites
foreach ($configFiles as $file){
@stnc
stnc / validator.php
Last active October 15, 2021 15:32
php turkey phone number validator (regex)
<?php
function turkcell_validator($str)
{
$regex = '/^(\+?12)?(9053\d{1}|7[1-9]\d{1})\d{7}$/';
preg_match_all($regex, $str, $matches, PREG_SET_ORDER, 0);
@stnc
stnc / chrome-bg-with-sw-communication.md
Created January 6, 2018 16:49 — forked from zdila/chrome-bg-with-sw-communication.md
How to send messages from service worker to the chrome extension without having the webapp open

In the background script we have:

chrome.webRequest.onBeforeRequest.addListener(function (details) {
  if (details.method === 'HEAD') {
    if (details.url.endsWith('?start')) {
      ringSound.play();
    } else if (details.url.endsWith('?stop')) {
      ringSound.pause();
 ringSound.currentTime = 0;
@stnc
stnc / export_google.php
Last active December 20, 2017 15:20
magento google merchant xml export
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
ini_set('memory_limit', '8000M');
$file_name = "xml_export_google1234.xml";
$google_category = 'Yiyecek, İçecekler ve Tütün Mamülleri > Yiyecek Çeşitleri > Meyve ve Sebzeler';
@stnc
stnc / goCraw2.go
Last active December 17, 2017 16:49
go lang crawler concurrency and sync example
package main
import (
"database/sql"
"fmt"
"io/ioutil"
"net/http"
"strconv"
"sync"
"time"
@stnc
stnc / craw.go
Last active November 29, 2017 12:45
goLang simple crawler
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {