Skip to content

Instantly share code, notes, and snippets.

View dvlden's full-sized avatar
🧨
I am the error that you should catch!

Nenad Novaković dvlden

🧨
I am the error that you should catch!
View GitHub Profile
@dvlden
dvlden / snippet.js
Last active September 11, 2017 17:06
Load any Script files - The asynchronous way
/* Example of how to load Facebook SDK */
loadAsync(document, 'script', '//connect.facebook.net/en_US/sdk.js', 'facebook-jssdk', successCallback);
function successCallback () {
console.log('Facebook\'s SDK successfully loaded.');
}
/* Asynchronously load any script files */
function loadAsync ( doc, elem, source, id, cb ) {
var ready = false,
@dvlden
dvlden / snippet.html
Last active September 11, 2017 17:09
Open link(s) in small browser dialog or new tab on phones/tablets
<a
href="https://google.com"
onClick="return popThis(this.href, 500, 370)">
Open Google
</a>
@dvlden
dvlden / .htaccess
Last active September 11, 2017 17:06
Pretty URL's are always nice and great in many cases. This is how you rewrite your URL's to remove / strip off php extension
<IfModule mod_rewrite.c>
# remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} \s(.+?)/+[?\s]
RewriteRule ^(.+?)/$ /$1 [R=301,L]
# To externally redirect /dir/file.php to /dir/file
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(.+?)\.php[\s?] [NC]
RewriteRule ^ /%1 [R=301,L,NE]