Skip to content

Instantly share code, notes, and snippets.

View ttibensky's full-sized avatar

Tomas Tibensky ttibensky

View GitHub Profile
@ttibensky
ttibensky / SuperCollection.php
Created November 4, 2024 16:14
Laravel collection typed wrapper class, with concern (child class)
<?php
declare(strict_types=1);
use Illuminate\Support\Collection;
/**
* @template-covariant T
*/
abstract class SuperCollection extends Collection
@ttibensky
ttibensky / .htaccess
Created March 10, 2020 18:34 — forked from Guibzs/.htaccess
Symfony 4 ~ .htaccess
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /index.php/
@ttibensky
ttibensky / .htaccess
Created March 10, 2020 18:34 — forked from Guibzs/.htaccess
Symfony 4 ~ .htaccess
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /index.php/
@ttibensky
ttibensky / gitlab-registry.gc.sh
Created November 8, 2018 17:11 — forked from eedugon/gitlab-registry.gc.sh
Manual garbage collector for gitlab registry, it removes old revisions that are not referenced by any tag
#!/bin/bash
# This is a modification of gitlab-gc.sh script created by Peter Bábics (pbabics/gitlab-gc.sh)
# Improvements
# - Searching in all BASE_PATH, not fixing the search to a depth of 2
# - Directories without valid tags or revisions directories won't be processed (to avoid unexpected issues)
# - Logging in case there's nothing to delete
# - running registry-garbage-collect only when something has been deleted
@ttibensky
ttibensky / generateAccessToken.php
Created August 24, 2014 08:57
ttibensky/twitter-api generating access token
<?php
if (empty($argv[1])) {
throw new \Exception('Please provide PIN.');
}
use TTibensky\TwitterApi\Api;
$api = new Api();
$api->setTokensDir(__DIR__.'/../app/tokens');
@ttibensky
ttibensky / generateRequestToken.php
Last active August 29, 2015 14:05
ttibensky/twitter-api generating request token
<?php
require_once __DIR__.'/../app/autoload.php';
use TTibensky\TwitterApi\Api;
$api = new Api();
$api->setTokensDir(__DIR__.'/tokens');
$api->setConsumerKey('xxxxxxxxxxxxxxxxxxxxxxxxx');
$api->setConsumerSecret('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
<?php
$sql = "SELECT * FROM article WHERE id = :user_id";
$sth = $dbh->prepare($sql);
$sth->execute(array(':user_id' => $_GET['id']));
$results = $sth->fetchAll();
<?php
$sql = "SELECT * FROM article WHERE id = ".$_GET['id'];
$results = $dbh->query($sql);
sudo chmod 644 settings.php
cp default.settings.php settings.php
sudo chmod 777 settings.php