Skip to content

Instantly share code, notes, and snippets.

View tournasdim's full-sized avatar
🎯
Focusing

Tournas Dimitrios tournasdim

🎯
Focusing
View GitHub Profile
@tournasdim
tournasdim / deny_access_to_directory
Created February 19, 2014 11:18
Deny access to a Directory with .htaccess
Order Deny,Allow
Deny from all
@tournasdim
tournasdim / git-stats
Created February 18, 2014 20:52
simply execute the script to have a summary of Git statistics per author . Just copy the script into "/usr/bin/" directory and make it executable "chmod +x"
#!/bin/bash
LOGOPTS=
END_AND_BEGIN=
#https://github.com/esc/git-stats
#argument parsing
while [ -n "$1" ]; do
case "$1" in
"-s")
shift
END_AND_BEGIN="$END_AND_BEGIN --after=$1"
@tournasdim
tournasdim / Bash_install_Gisto
Created February 11, 2014 21:40
A simple Bash script for automatically installation of gisto
#!/bin/bash
if [ "${1}" = "--uninstall" ]; then
/bin/rm -rf /usr/bin/gisto /usr/bin/nw.pak /usr/share/applications/gisto.desktop usr/share/menu/gisto /usr/share/pixmaps/gisto.png /usr/share/pixmaps/gisto.xpm
echo -e '\n\n\n\e[44m \e[0m Congrats! Gisto removed from your machine.\n\n\n'
exit 1
fi
is_root() {
if [[ $EUID -ne 0 ]]; then
@tournasdim
tournasdim / SPL_RecursiveArrayIterator
Created November 4, 2013 22:25
A simple example of SPL's RecuriseveArrayIterator
<?php
$myData = array(
['name' => 'dimitrios' ,
['address' => 'SomeAddress' , 'country' => 'Greece' , ['phone'=> 4568765 , 'mobile' => 76599585]]] ,
['name' => 'Jhon' ,'address' => 'Alimos' , 'country' => 'France' , 'phone' => 6577474] ,
['name' => 'Justin' , 'address' => 'Sint Johnson ' , 'country' => 'UK' , 'phone' => '8875775']
);
@tournasdim
tournasdim / SPL_FilterIterator
Created November 4, 2013 19:36
A simple implementation of SPL's FilterIterator Class .
<?php
class CustomFilterIterator extends FilterIterator
{
protected $filterKey ;
protected $filterValue ;
public function __construct($iter, $key , $value )
{
parent::__construct($iter);
@tournasdim
tournasdim / Url.php
Created September 6, 2013 20:29
L4 Url (Examples of generating Url's with helper functions and facades)
<?php
Illuminate\Routing\UrlGenerator
__construct(RouteCollection $routes, Request $request) Both parameter ar from Symfony
full() // Get the full URL for the current request.
current() // Get the current URL for the request.
previous() // Get the URL for the previous request.
to($path, $parameters = array(), $secure = null) // Generate a absolute URL to the given path.
secure($path, $parameters = array()) // Generate a secure, absolute URL to the given path.
asset($path, $secure = null) // Generate a URL to an application asset.
@tournasdim
tournasdim / Bootstrap-nav.html
Created September 1, 2013 11:43
Bootstrap , navbar with Fontawesome and CDN links
<!doctype html>
<html>
<head>
<!-- http://fortawesome.github.io/Font-Awesome/get-started/ -->
<meta charset="utf-8">
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<title>Navbar with dropdowns</title>
</head>
/* Start by setting display:none to make this hidden.
Then we position it in relation to the viewport window
with position:fixed. Width, height, top and left speak
speak for themselves. Background we set to 80% white with
our animation centered, and no-repeating */
.modal {
display: none;
position: fixed;
z-index: 1000;
top: 0;
@tournasdim
tournasdim / Composer_create_project.php
Created August 27, 2013 06:45
Composer : One line installation of Laravel with Composer (no more "git clone ....." )
<?php
// One line installation of Laravel with composer
composer create-project laravel/laravel
@tournasdim
tournasdim / Migration_seeder.php
Created August 26, 2013 10:59
L4 Migration and seed example (a full example , from generating migration / seed files upto seeding to db with CLI)
<?php
php artisan migrate:make create_user_table
// app/database/migrations folder
<?php
use Illuminate\Database\Migrations\Migration;
class CreateUserTable extends Migration {
public function up()
{