Skip to content

Instantly share code, notes, and snippets.

View dusta's full-sized avatar
:octocat:
Visionary Programmer

Sławomir Kaleta dusta

:octocat:
Visionary Programmer
View GitHub Profile
@dusta
dusta / generateRandomString.php
Last active April 8, 2017 08:40
Function generate random string
<?php
/**
* Randomly generated string
*/
function generateRandomString($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
@dusta
dusta / objectToArray.php
Last active April 8, 2017 08:39
Function Convert object to array
<?php
/**
* Convert object to array
*/
function objectToArray($obj) {
if(is_object($obj))
$obj = (array) $obj;
if(is_array($obj)) {
@dusta
dusta / pathFile.php
Created April 8, 2017 08:46
Function returnig the path to a folder and a file
<?php
/**
* Explode patch to folder and file
* function pathFile('patch1/patch2/patch3/file1.php')
* return array('patch1/patch2/patch3/', 'file1.php')
*/
function pathFile($path) {
$folder = '';
$name = $path;
@dusta
dusta / MigrationGoldShopToPrestaShop.txt
Last active October 14, 2017 09:22
Migration GoldShop to PrestaShop
MIGRACJA UŻYTKOWNIKÓW krok po kroku Z GOLDSHOP NA PRESTASHOP
=====================================
# Zgranie użytkownków tych co nie ma jeszcze
# Wynik Teraz trzeba pobrać cvs tego zapytania i wgrać
# Pojawi się tabela ~TABLE 296 do następnie poustawiać nazwy column
# COL1, COL2....
# Na takie jakie istnieją w bazie np col1 na np email
#
# Po zmianie kolum i pobraniu plik będzie miał
@dusta
dusta / function.token.php
Last active July 27, 2018 18:50
Smarty plugin Dframe/Token
<?php
/*
* Smarty plugin for Dframe\Token
* -------------------------------------------------------------
* File: function.token.php
* Type: function
* Name: token
* Purpose: outputs a token
* -------------------------------------------------------------
*/
@dusta
dusta / Deploy_on_cPanel.md
Last active September 9, 2024 04:27 — forked from oodavid/README.md
Deploy your site with git on cPanel

Deploy your site with git on cPanel

The most important: You must have shell access!

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
  • your (PHP) scripts are served from /var/www/html/
@dusta
dusta / AjaxRestFrom.html
Last active July 17, 2018 11:57
Ajax data attributes
<script src="https://code.jquery.com/jquery-3.3.1.js"
integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
crossorigin="anonymous"></script>
<div class="form" data-action="https://google.com" data-method="GET">
Query: <input type="text" name="q" value="test">
<button type="button" class="submit btn btn-success">Wyślij GET</button>
</div>
<div class="form" data-action="https://google.com" data-method="POST">
@dusta
dusta / FileStorageFileUpload.php
Created July 12, 2018 09:11
dframe/filestorage upload file with slug path generator
<?php
$method = $_SERVER['REQUEST_METHOD'];
switch ($method) {
case 'POST':
if (!isset($_FILES) and !isset($_FILES['attachment']) or !isset($_POST['publication_id']) or empty($_POST['publication_id'])) {
return ($view->renderJSON(array('return' => '0', 'response' => 'Blad formularza')));
}
$publicationId = htmlspecialchars($_POST['publication_id']);
<div class="container">
<h1 class="font-header">Server Monitor</h1>
<p class="lead">Service <small>List</small> </p>
<table class="table">
<thead>
<tr>
<td>Nazwa</td>
<td>Opis</td>
@dusta
dusta / ThatForm.php
Last active July 19, 2018 08:09
Biblioteka sprawdzająca czy są wymagane posty oraz czy nie są one puste
<?php
/**
* Biblioteka sprawdzająca czy są wymagane posty oraz czy nie są one puste
* kajtek
*/
/**
* @author Sławomir Kaleta <[email protected]>
*/