Skip to content

Instantly share code, notes, and snippets.

View useless-stuff's full-sized avatar
🤓
Learning

1317 useless-stuff

🤓
Learning
View GitHub Profile
@useless-stuff
useless-stuff / php_limit_iterator.php
Last active February 16, 2016 11:09
PHP - LimitIterator
<?php
/**
* Class RandomObject
*/
class RandomObject
{
protected $value;
/**
@useless-stuff
useless-stuff / php_caching_iterator.php
Created February 16, 2016 13:37
PHP - CachingIterator
<?php
$nav = array(
'Home' => '/home',
'Products' => '/products',
'Company' => '/company',
'Privacy Policy' => '/privacy-policy',
);
/**
* Class NavBuilder
@useless-stuff
useless-stuff / php_recursive_caching_iterator.php
Created February 16, 2016 14:28
PHP - RecursiveCachingIterator
<?php
/**
* Class User
*/
class User
{
public $name;
/**
@useless-stuff
useless-stuff / php_norewind_iterator.php
Last active February 16, 2016 14:45
PHP - NoRewindIterator
<?php
/**
* Class Message
*/
abstract class Message
{
protected $text;
/**
@useless-stuff
useless-stuff / php_empty_iterator.php
Last active February 16, 2016 23:54
PHP - EmptyIterator
<?php
/**
* Class Adapter
*/
abstract class Adapter extends RecursiveArrayIterator{
}
/**
* Class GoogleDriveAdapter
@useless-stuff
useless-stuff / error_template.php
Last active March 10, 2016 07:40
WP - Gister plugin
<div class="error">
Gister plugin: you must specified a snippet id attribute for render gist code, try with [gister snippet-id="put here the code"]
</div>
@useless-stuff
useless-stuff / php_infinite_iterator.php
Created February 18, 2016 14:47
PHP - InfiniteIterator
<?php
// Use InfititeIterator for traversing a circular data structure
// https://en.wikipedia.org/wiki/Circular_buffer
/**
* Interface AvailabilityService
*/
interface AvailabilityService
{
/**
@useless-stuff
useless-stuff / anniballo.com.conf
Last active February 9, 2023 16:38
TLS/SSL - Let's Encrypt free SSL certificate virtual host example
<VirtualHost *:80>
ServerName anniballo.com
ServerAlias diego.anniballo.com www.anniballo.com
Redirect permanent / https://diego.anniballo.com/
</VirtualHost>
<VirtualHost *:443>
ServerName anniballo.com
ServerAlias diego.anniballo.com www.anniballo.com
ServerAdmin [email protected]
# [...]
@useless-stuff
useless-stuff / letsencrypt.sh
Created February 18, 2016 20:26
TLS/SSL - Let's Encrypt free SSL certificate install script
#!/bin/bash
a2enmod ssl -y
apt-get update -y
apt-get install git -y
git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
cd /opt/letsencrypt
./letsencrypt-auto --apache -d anniballo.com -d diego.anniballo.com -d www.anniballo.com
@useless-stuff
useless-stuff / letsencrypt.sh
Last active September 23, 2018 13:17
TLS/SSL - Let's Encrypt free SSL certificate install script
#!/bin/bash
a2enmod ssl -y
apt-get update -y
apt-get install git -y
git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
cd /opt/letsencrypt
./letsencrypt-auto --apache -d domain.com -d domain.com -d domain.com