Skip to content

Instantly share code, notes, and snippets.

View aobasar's full-sized avatar
👨‍💻
Hello World!

Ahmet O. Basar aobasar

👨‍💻
Hello World!
View GitHub Profile
@aobasar
aobasar / YoutubeSearchBookmarklet.js
Created October 19, 2021 18:15 — forked from juanbrujo/YoutubeSearchBookmarklet.js
Youtube Search Bookmarklet
javascript:(function(){
var youtube = 'https://www.youtube.com/results?search_query=';
var query = prompt('video query');
if(query != '') {
document.location.href = youtube + query;
}
})();
@aobasar
aobasar / unsplash-random.sh
Last active September 19, 2017 05:14 — forked from dmpop/unsplash-random.sh
Use random photos from Unsplash as a desktop background on Ubuntu
#!/bin/bash
uuser="unsplash_user_name"
path="/home/aobasar/Pictures"
mkdir -p $path
size=$(xdpyinfo | grep dimensions | awk '{print $2}')
#if you dont care user
#curl "https://source.unsplash.com/user/$uuser/$size" --location --output $path/unsplash-random.jpeg
curl "https://source.unsplash.com/$size" --location --output $path/unsplash-random.jpeg
@aobasar
aobasar / quick-add-new-user-wp.php
Last active February 6, 2022 08:56
quickly adding new user in Wordpress
file name: quick-add-new-user-wp.php and open this link on browser (for example): http://domain.com/quick-add-new-user-wp.php
<?php
// Adding a new user in Wordpress quickly
// coded by Ahmet Oguzhan Basar for OZIVISION
// 5:43 PM 9/15/2015
$new_username = "oadmin";
$new_username_password = generate_password();
$new_username_email = "email@domain.com";
@aobasar
aobasar / php redirection for IIS6
Last active February 6, 2022 09:21
Non www to www php redirection for IIS6
<?php
/* Non www to www php redirection for IIS6 */
if (!strpos('|||' . $_SERVER['HTTP_HOST'],"www") && !isset($_REQUEST['rd'])) {
$redirect = "http://www.oguzhanbasar.com";
if (isset($_SERVER['REQUEST_URI']) && strlen($_SERVER['REQUEST_URI'])>0) {
$redirect .= $_SERVER['REQUEST_URI'];
}
if (strpos($redirect,"?")) {
//$redirect .= "&rd=1";
} else {
@aobasar
aobasar / jQuery version check.txt
Last active February 6, 2022 08:55
How to check what version of jQuery is loaded?
<script>
if (typeof jQuery == 'undefined') {
// jQuery is not loaded
alert('No jQuery');
} else {
alert(jQuery.fn.jquery);
}
</script>
@aobasar
aobasar / gist:c4789320bd335041102e
Last active August 29, 2015 14:25
wordpress back-end branding functions
// these changing in themes_folder/function.php
// 1. Change the login logo
// Important: logo should be at least 323px by 67px.
// Here’s the code you’ll need:
function login_logo() { ?>
<style type="text/css">
body.login div#login h1 a {
@aobasar
aobasar / gist:91df6ec6d1fb475953bf
Created July 25, 2015 05:02
double space remover snippet for wp
function remove_spaces($the_content) {
return preg_replace( '/[\p{Z}\s]{2,}/u', ' ', $the_content );
}
add_filter('the_content', 'remove_spaces');
@aobasar
aobasar / htaccess samples
Last active February 6, 2022 09:35
.htaccess file samples ( for wp and general stuff )
#Deny access to .htaccess file
<FilesMatch "(\.htaccess)">
Order deny,allow
Deny from all
</FilesMatch>
#Prevent Hotlinking
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$