Skip to content

Instantly share code, notes, and snippets.

View E1101's full-sized avatar
🏠
Working from home

Payam Naderi E1101

🏠
Working from home
View GitHub Profile
<?php
public function postFile()
{
$file_url = "test.txt"; //here is the file route, in this case is on same directory but you can set URL too like "http://examplewebsite.com/test.txt"
$eol = "\r\n"; //default line-break for mime type
$BOUNDARY = md5(time()); //random boundaryid, is a separator for each param on my post curl function
$BODY=""; //init my curl body
$BODY.= '--'.$BOUNDARY. $eol; //start param header
$BODY .= 'Content-Disposition: form-data; name="sometext"' . $eol . $eol; // last Content with 2 $eol, in this case is only 1 content.
$BODY .= "Some Data" . $eol;//param data in this case is a simple post data and 1 $eol for the end of the data
@E1101
E1101 / nth_prime.php
Created December 17, 2017 08:55
Get A Number In Prime Series By Index; The nTH Prime.
<?php
function getPrimingSeriesIndex($index)
{
if ( $index <= 0 )
return false;
if ($index == 1)
return 2;
@E1101
E1101 / resume.php
Created February 28, 2018 05:13
Resume Upload
<?php
$CHUNK = 8192;
try {
if (!($putData = fopen("php://input", "r")))
throw new Exception("Can't get PUT data.");
// now the params can be used like any other variable
// see below after input has finished
@E1101
E1101 / usage.sh
Created November 18, 2018 10:38
Linux Resources Usage
####################################################################################################
# Usage.sh #
# Written by Ali Hallaji #
# If any bug, report me in my Github page at below #
# Free to use/edit/distribute the code below by #
# giving proper credit to Author #
# Link: https://github.com/ali-hallaji/system-usage-bash #
####################################################################################################
#! /bin/bash
# unset any variable which system may be using
<?php
/**
* Reverse Words In Array Of Charachters
*
* @param array $input
*
* @return array
*/
function reverseWords(array $input) : array
{
CREATE TABLE order_info(
order_id INT NOT NULL,
product_id INT NOT NULL,
option_attribute VARCHAR(20),
option_value VARCHAR(20),
PRIMARY KEY(order_id,product_id,option_attribute,option_value)
);
INSERT INTO order_info VALUES
(1,10,'Colour','Red'),(1,10,'Size','Large'),(1,10,'Sleeve','Short'),
(2,10,'Colour','Blue'),(2,10,'Size','Small'),(2,10,'Sleeve','Long');
@E1101
E1101 / php7.php
Last active April 28, 2021 06:45
PHP New Features
<?php
## --------------------------------------------------
## PHP ^7.4
## --------------------------------------------------
##
# Typed properties
#
class User {
@E1101
E1101 / PHP7-extensions.md
Created April 25, 2016 09:15
PHP 7 Extensions

Extensions Catalog

This page holds everything we know about every extension we know about. Instructions for working with this page can be found on our main website.

If this page is annoyingly narrow to read, try this: https://github.com/xthexder/wide-github

Core Extensions

Name Homepage/location Has maintainers Has tests Has docs Works on PHP5 Works on PHP7 Is good on PHP 7 Details
@E1101
E1101 / spam_list.txt
Created July 26, 2017 10:29
List Of SPAM Mail Server providers
0815.ru
0815.ru0clickemail.com
0815.ry
0815.su
0845.ru
0clickemail.com
0-mail.com
0wnd.net
0wnd.org
10mail.com
<?php
final class OrderLevelShippingCalculatorTest extends TestCase
{
public function testItEnsuresOrderIncludeShippingFeeCollection()
{
$order = SalesOrderBuilder::initialOrder();
$invoice = InvoiceBuilder::initialInvoice();
$calculator = $this->createCalculator(