Skip to content

Instantly share code, notes, and snippets.

# Tweet Message "To send this tweet* I’ve used only Github Copilot suggestions with a programming language I am not familiar with 😮\n\n*through twitter API"
twitterMessage = "To send this tweet* I’ve used only Github Copilot suggestions with a programming language I am not familiar with 😮\n\n*through twitter API"
# post tweet to twitter
import tweepy
import os
# send tweet
def send_tweet(message):
# Twitter API credentials
@scoumbourdis
scoumbourdis / ExportState.php
Last active July 25, 2020 07:10
A PHP library for replacing the default Export State of Grocery CRUD Enterprise
<?php
namespace MyCustomStates;
use GroceryCrud\Core\GroceryCrud as GCrud;
use GroceryCrud\Core\State\StateInterface;
use GroceryCrud\Core\State\ExportState as GcExportState;
class ExportState implements StateInterface {
@scoumbourdis
scoumbourdis / messy-code.php
Created June 15, 2020 10:39
This is an example of a messy code. Please do not copy any of this code as this is just an example of a bad code
<?php
// This is an example of a messy code. Please do not copy any of this code as this is just an example of a bad code.
if (!empty($_GET['id'])) {
$id = $_GET['id'];
if (!is_numeric($id)) {
header("HTTP/1.0 404 Not Found");
echo "<h1>⚠️ We are sorry, page not found</h1>";
die;
}
} else {
@scoumbourdis
scoumbourdis / Example.php
Last active June 4, 2020 03:39
Example Controller for Grocery CRUD Enterprise and Codeigniter 4
<?php
namespace App\Controllers;
include(APPPATH . 'Libraries/GroceryCrudEnterprise/autoload.php');
use GroceryCrud\Core\GroceryCrud;
class Example extends BaseController
{
public function index()
{
<VirtualHost *:80>
DocumentRoot "/var/www/my-test-project/public"
ServerName my-test-project.local
ServerAlias www.my-test-project.local
</VirtualHost>
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
include(APPPATH . 'libraries/GroceryCrudEnterprise/autoload.php');
use GroceryCrud\Core\GroceryCrud;
class Examples extends CI_Controller {
public function __construct() {
parent::__construct();
<?php
return [
'adapter' => [
'driver' => 'Pdo_Pgsql', // This is the driver that you should be using
'database' => 'my_database_name',
'username' => 'my_username',
'password' => 'my_password'
'charset' => 'utf8'
]
];
@scoumbourdis
scoumbourdis / example.php
Last active June 3, 2020 04:19
Grocery CRUD Enterprise app/Views/example.php for Codeigniter 4
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<?php
foreach($css_files as $file): ?>
<link type="text/css" rel="stylesheet" href="<?php echo $file; ?>" />
<?php endforeach; ?>
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Examples extends CI_Controller {
function __construct() {
parent::__construct();
/* Standard Codeigniter Libraries */
@scoumbourdis
scoumbourdis / GroceryCrudEnterprise.php
Last active September 5, 2020 06:11
This is the default configuration for Grocery CRUD Enterprise and Codeigniter 4
<?php namespace Config;
use CodeIgniter\Config\BaseConfig;
class GroceryCrudEnterprise extends BaseConfig
{
public function getDefaultConfig() {
helper('url');
return [