This gist is about:
- https://twitter.com/taylorotwell/status/600680897550098432
- https://twitter.com/Ocramius/status/600705252539691008
Mainly:
function
cannot (should not) be used when side-effects occur
<?php | |
/* Gets individual core information */ | |
function GetCoreInformation() { | |
$data = file('/proc/stat'); | |
$cores = array(); | |
foreach( $data as $line ) { | |
if( preg_match('/^cpu[0-9]/', $line) ) | |
{ | |
$info = explode(' ', $line ); | |
$cores[] = array( |
<?php | |
$emoji =[ | |
'😀', | |
'😃', | |
'😄', | |
'😁', | |
'😆', | |
'😅', | |
'🤣', | |
'😂', |
<?php | |
$token = YOUR_BOT_TOKEN; | |
//your bot must be admin of both channel. | |
$original_from_chat_id = ORIGINAL_CHAT_ID; // like this -1001122688109 | |
$target_chat_id = TARGET_CHAT_ID; // like this -1001131688104 |
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '" | |
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'; | |
if( $found ){ | |
$remoteport = $matches[0]; | |
} else{ | |
echo "The Script Exited, the ip address of WSL 2 cannot be found"; | |
exit; | |
} |
<?php | |
//here is composer.json | |
// { | |
// "require": { | |
// "ybagheri/easyhelper": "dev-master", | |
// "ybagheri/easytelegram": "dev-master", | |
// "james-heinrich/getid3": "^1.9", | |
// "josegonzalez/dotenv": "dev-master", | |
// "ybagheri/strfun": "dev-master" | |
// }, |
-- When SQLite is compiled with the JSON1 extensions it provides builtin tools | |
-- for manipulating JSON data stored in the database. | |
-- This is a gist showing SQLite return query data as a JSON object. | |
-- https://www.sqlite.org/json1.html | |
-- An example table with some data | |
CREATE TABLE users ( | |
id INTEGER PRIMARY KEY NOT NULL, | |
full_name TEXT NOT NULL, | |
email TEXT NOT NULL, |
from telethon import TelegramClient | |
from telethon.errors.rpc_errors_401 import SessionPasswordNeededError | |
# (1) Use your own values here | |
api_id = 17349 | |
api_hash = '344583e45741c457fe1862106095a5eb' | |
phone = 'YOUR_NUMBER_HERE' | |
username = 'username' |
This gist is about:
Mainly:
function
cannot (should not) be used when side-effects occur<?php | |
/** | |
* Close the connection to the browser but continue processing the operation | |
* @param $body | |
*/ | |
public function closeConnection($body, $responseCode){ | |
// Cause we are clever and don't want the rest of the script to be bound by a timeout. | |
// Set to zero so no time limit is imposed from here on out. | |
set_time_limit(0); |
<?php | |
class Product implements ArrayAccess | |
{ | |
protected $_productId; | |
protected $_title; | |
protected $_price; | |
protected $_arrayAccess; | |
public function __construct($data = null) |