Skip to content

Instantly share code, notes, and snippets.

@m5lil
Last active March 21, 2018 14:39
Show Gist options
  • Save m5lil/af858dd4677d257e3d01cb6992e73d04 to your computer and use it in GitHub Desktop.
Save m5lil/af858dd4677d257e3d01cb6992e73d04 to your computer and use it in GitHub Desktop.
Some useful codes for websites

add .active to parent [li] of [a] current opened tag

  $(function () {
      // Navigation active
      $('ul.navbar-nav a[href="{{ "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" }}"]').closest('li').addClass('active');
  });

copyright

  &copy; {{ date('Y') }}. Created by <a href="http://khlilio.me">Mahmoud Khalil</a>

return 'INV-' . sprintf( "%04d", $this->id);

# Redirect Trailing Slashes If Not A Folder...                          
RewriteCond %{REQUEST_FILENAME} !-d                                     
RewriteRule ^(.*)/$ /$1 [L,R=301]  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment