Skip to content

Instantly share code, notes, and snippets.

View Alys-dev's full-sized avatar
🏠
Working from home

Alys Alys-dev

🏠
Working from home
View GitHub Profile
@harisrozak
harisrozak / simple-excerpt.php
Last active May 28, 2023 20:12
PHP :: Simple PHP Excerpt
<?php
/**
* $pos = get cut position based on fixed position ($fixed),
* but without break last word
*/
$text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.";
$excerpt = '';
$fixed = 25;
@UziTech
UziTech / glob_recursive.php
Last active May 25, 2023 18:32
Recursive glob search in php
/*
* License: DWTFYW
*/
/**
* Search recusively for files in a base directory matching a glob pattern.
* The `GLOB_NOCHECK` flag has no effect.
*
* @param string $base Directory to search
* @param string $pattern Glob pattern to match files
@bcls
bcls / PHP_PUT_file.php
Last active May 28, 2023 20:10
PHP PUT file #php
$file = fopen($file_on_dir_not_url, "rb");
$curl = curl_init();
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_BINARYTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_PUT, true);
@lunule
lunule / jquery-detect-css3-animations-and-transitions-end.js
Last active May 29, 2023 17:12
[jQuery - Detect CSS3 Animations & Transitions End] #jquery #animation #transition #css #javascript
/**
* Using jQuery to Detect When CSS3 Animations and Transitions End
* @see https://blog.teamtreehouse.com/using-jquery-to-detect-when-css3-animations-and-transitions-end
*/
jQuery(document).ready(function($) {
'use strict';
const myButton = $('.my-button'),
@PetraMotz
PetraMotz / code.php
Last active May 28, 2023 21:12
PHP #xml #php
/**
* writes and saves xml file with given data
* @param array $data
* @param array $order
*/
private function writeXmlFile($data, $orderArray){
$today = date_format( new \DateTime(), 'Y-m-d\TH:i:s'); //2018-07-25T11:20:12
$orderNr = 'gbp'.date_format(new \DateTime(), 'y\TH:i:s');
$xml = new \SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><orders/>');
@jwhulette
jwhulette / ForeignKey.php
Last active May 28, 2023 20:50
[Check if foreign key exits] #php #laravel
<?php
declare(strict_types=1);
namespace Database\Helpers;
use Illuminate\Support\Facades\Schema;
class ForeignKey
{
@jwhulette
jwhulette / Column.php
Last active May 28, 2023 20:50
[Check if column exists] #php #laravel
<?php
declare(strict_types=1);
namespace Database\Helpers;
use Illuminate\Support\Facades\Schema;
class Column
{